I have 2 tables and want to compare them and modify tableA (set NameMod = 1) if it has different rows.
To compare tables I use:
select Id, Name from tableB
except
select Id, Name from tableA
And then I want to modify tableA:
update tableA Set NameMod = 1
where exists (
select Id, Name from tableB
except
select Id, Name from tableA
)
But I can only use EXISTS before the sub-query and in this case it updates all elements in table not different rows.