Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Cnichols
So GROUP BY will separate the the grouping done by sum()? So that also means I could factor in all discounts not just static ones? Like so? Modifier 0 = Percent Of and 1 = Static amount? Also which statement is going to be more efficient the UPDATE or the REPLACE? REPLACE INTO MemberAccounts

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Cnichols
So the sum() function brings the multiple discounts together for a member in the UPDATE statement? So I have a question regarding this then the Discount.Modifier stands for 0 = percent of a value or 1 = static The update you constructed would work for all static values since sums groups all the

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Clark Christensen
DOH! I stand corrected. Guess I should RTFM before I speak :-)) Thanks! -Clark - Original Message From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Thursday, November 30, 2006 4:52:25 PM Subject: Re: [sqlite] REPLACE INTO Only Exec

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread drh
Clark Christensen <[EMAIL PROTECTED]> wrote: > I don't think SQLite supports "REPLACE INTO..." I'm pretty sure "REPLACE" = > is a conflict action in SQLite. > > Perhaps "INSERT OR REPLACE INTO Memb= > erAccounts (MemberId, Balance) SELECT..." will do what you want? > I went to the extra

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Cnichols
Thanks alot the UPDATE works great! Although the REPLACE INTO still only executes the last row of a multi discount. Igor Tandetnik wrote: > > Cnichols <[EMAIL PROTECTED]> wrote: >> I have a complex SQL statement which attempts to update all Member >> Accounts balance with a discount if there

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Cnichols
hat you want? > > -Clark > > - Original Message > From: Cnichols <[EMAIL PROTECTED]> > To: sqlite-users@sqlite.org > Sent: Thursday, November 30, 2006 2:22:19 PM > Subject: [sqlite] REPLACE INTO Only Executes last SELECT? > > > I have a c

Re: [sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Clark Christensen
<[EMAIL PROTECTED]> To: sqlite-users@sqlite.org Sent: Thursday, November 30, 2006 2:22:19 PM Subject: [sqlite] REPLACE INTO Only Executes last SELECT? I have a complex SQL statement which attempts to update all Member Accounts balance with a discount if there anniversary falls between l

[sqlite] REPLACE INTO Only Executes last SELECT?

2006-11-30 Thread Cnichols
I have a complex SQL statement which attempts to update all Member Accounts balance with a discount if there anniversary falls between last handled date and the current day. REPLACE INTO MemberAccounts (MemberId, Balance) SELECT DA.MemberId, (MA.Balance - D.Amount) AS Amount FROM