SQL: Update a column with multiple values with single query

Posted by Sandeep Jindal on Stack Overflow See other posts from Stack Overflow or by Sandeep Jindal
Published on 2011-01-14T11:43:13Z Indexed on 2011/01/14 11:53 UTC
Read the original article Hit count: 261

Filed under:

Hi,

I have an update query like following:

update table TABLE1 set COL1 = 'X' where COL2 = 'Y' ---1

Support the values 'X' and 'Y' are fetched from database now TABLE2. E.g.

select COL1, COL2 from TABLE2. ----2

I want to update table TABLE1 with values from TABLE2.

Just to make it more clear, assume that TABLE2 has following values:

alt text

Can you please help me in doing this in a single query!

© Stack Overflow or respective owner

Related posts about sql