Re: [SQL] Update help

2002-09-05 Thread Ligia Pimentel
update table1 set price = table2.price where table1.productId = table2.productId; (Of course, both tables must have a different name). :) Ligia ""[EMAIL PROTECTED]"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This is a multi-part message in MIME format

[SQL] Update help

2002-09-03 Thread [EMAIL PROTECTED]
Hi, Let say I have 2 Product table, both of them has columns ProductID and Price What is the update command if I want to update all Prices of first table to be equal with Price in second table?   Please Help.   Yudie

Re: [SQL] Update Help

2002-09-03 Thread Peter Eisentraut
[EMAIL PROTECTED] writes: > Let say I have 2 Product table, both of them has columns ProductID and > Price What is the update command if I want to update all Prices of first > table to be equal with Price in second table? Possibly you mean something like this: UPDATE first_table SET price = (SE

Re: [SQL] Update Help

2002-09-03 Thread Oliver Elphick
On Tue, 2002-09-03 at 17:38, [EMAIL PROTECTED] wrote: > Let say I have 2 Product table, both of them has columns ProductID and Price > What is the update command if I want to update all Prices of first table to be equal with Price in second table? UPDATE table1 SET price = (SELECT pric

[SQL] Update Help

2002-09-03 Thread [EMAIL PROTECTED]
Hi, Let say I have 2 Product table, both of them has columns ProductID and Price What is the update command if I want to update all Prices of first table to be equal with Price in second table?   Please Help.   Yudie

Re: [SQL] update help

2001-01-17 Thread Josh Berkus
Tom, > UPDATE t1 SET amount = (select sum(b.amount) from t2 b > WHERE t1.id = b.id); Interesting. I'm used to (not necessarily in PGSQL): UPDATE t1 SET amount = t2ttl.totalamount FROM (SELECT sum(amount) as totalamount, id FROM t2 GROUP BY id) t2ttl WHERE t1.id = t2.id Althoug

Re: [SQL] update help

2001-01-17 Thread Tom Lane
Carolyn Wong <[EMAIL PROTECTED]> writes: > I'd like to know what's the correct SQL statement to do the following: > updatet1 a > set a.amount = sum(b.amount) > from t2 b > where a.id = b.id Try UPDATE t1 SET amount = (select sum(b.amount) from t2 b WHERE t1.id = b.id); Or possibly yo

Re: [SQL] update help

2001-01-17 Thread Tubagus Nizomi
update t1 set amount = sum(b.amount) from ts b where a.id=b.id On Thursday 18 January 2001 09:54, Carolyn Wong wrote: > I'd like to know what's the correct SQL statement to do the following: > > updatet1 a > set a.amount = sum(b.amount) > from t2 b > where a.id = b.id

[SQL] update help

2001-01-17 Thread Carolyn Wong
I'd like to know what's the correct SQL statement to do the following: update t1 a set a.amount = sum(b.amount) fromt2 b where a.id = b.id