this should work.
UPDATE T1
SET T1.colA = (select T2.colA from T2 where T1.colC = T2.colC),
T1.colB = (select T2.colB from T2 where T1.colC = T2.colC)
WHERE EXISTS (select * from T2 where T1.colC = T2.colC);
Unit 5 wrote:
Hello,
I am trying to update values of some columns in a
table with fresh data from another table. The two
tables have the same column definitions. Is this
possible? Even better would be if the two tables
could be the same; then I could use table aliases in
the update statement.
Here is what I would like to do:
UPDATE T1
SET T1.colA = T2.colA,
T1.colB = T2.colB
FROM T1, T2
WHERE T1.colC = T2.colC
Thanks in advance!
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com