Ravi Kumar. wrote:
Dear Friends,
I have two tables: T1, T2.
T1 has 3 columns: playerid, gameid, score
T2 has 2 columns: playerid, totalscore.
I wish to update table T2 such that sum of T1.score of each player, gets
updated in T2.totalscore. It may be something like this:
update T2, T1 s
ViSolve DB Team wrote:
Hi,
Try this..
UPDATE table2 inner join table1 on table2.playedid=table1.playerid
SET table2.totalscore=sum(table1.score)
Just a guess...
Thanks,
ViSolve DB Team
- Original Message - From: "Ravi Kumar." <[EMAIL PROTECTED]>
To:
Sent: Wednesday, December 06, 200
Hi,
Try this..
UPDATE table2 inner join table1 on table2.playedid=table1.playerid
SET table2.totalscore=sum(table1.score)
Just a guess...
Thanks,
ViSolve DB Team
- Original Message -
From: "Ravi Kumar." <[EMAIL PROTECTED]>
To:
Sent: Wednesday, December 06, 2006 4:11 PM
Subject: Upd
Yeah I thought of that but was hoping not to have to use a temp table.
Thanks!
Jeff
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, November 05, 2004 9:25 AM
To: Jeff McKeon
Cc: [EMAIL PROTECTED]
Subject: Re: Update query help
Break it down into two
Break it down into two steps. Compute your new values by customerid, then
update your customer table with your computed data.
CREATE TEMPORARY TABLE tmpFirstTran
SELECT CustID, min(Datestamp) as mindate
from Transactions
group by CustID;
update Customer c INNER JOIN tmpFirstTran ft ON ft.CustID