Hey,
I need to update a row in one table with a row (most but not all
columns) from another table. This sounds like there should be a really
easy way to do this. I've seen there's FROM in the UPDATE statement but
haven't found any similar examples.
Basically, I need something like this pseudo-code:
update table2 set something = table1.somethin g (??)
from table1
where table2.id = 150
but, i only need some of the columns from table1 into table2.
I've seen things like:
update table2 set
table2.col1 =
(select table1.col1 where table1.id = 10),
table2.col2 =
(select table1.col2 where table1.id = 10)
where table2.id = 10
....but this seems really verbose, because there's like a dozen columns.
Even a link to a tutorial is welcome, thanks!
:rob
Comment