Reputation: 1626
I want to update a field based on a where IN ()
clause but i also want the update the rest of the values using WHERE NOT IN()
..For example:
UPDATE TABLE SET COLUMN1 = X WHERE COLUMN2 IN (1,2,3)
UPDATE TABLE SET COLUMN1 = Y WHERE COLUMN2 NOT IN (1,2,3)
To simply put it ,is there a way to combine these two queries?
Upvotes: 0
Views: 56
Reputation: 338128
UPDATE
TABLE
SET
COLUMN1 = CASE WHEN COLUMN2 IN (1,2,3) THEN X ELSE Y END
Upvotes: 8