I'm attempting to update a single column in one table based on information from another but only if they are not already the same. The beginning part of the code below (up until case) is what I've got that works so far, but I can't seem to get the syntax right to compare before the update.
UPDATE table1
SET table.column1 = table2.column2
FROM table1
inner join table2 ON
table1.KEY = table2.KEY
WHERE column4 = something and DATE between '10/12/14' and '10/15/14'
CASE
WHEN table1.column1 != table2.column2
end;
I'm using SQL server 2008r2 but any SQL-compatible code is great too. Thanks.
It's the compare part that was throwing me for a loop. Not the straight update with joining tables. That's why the other question wasn't quite right.