I have a SQL UPDATE clause which looks like:
UPDATE table
SET column =value
FROM
(SELECT bla bla FROM bla bla WHERE col = val)
JOIN
(SELECT bla bla FROM bla bla WHERE col = val)
I want to limit the UPDATE to WHERE a particular column is equal to a particular value.
It doesnt appear to be legal to insert the WHERE after the JOIN or after the SET? I thought I had already limited the update using the JOIN but it doesn’t appear so.
Where can I insert my WHERE clause?
If this
vlaueis a literal value, not a value coming form either of these joined tables, then you can do this:Or:
However, if this
valueis coming from one of the joined table: