I have a table called A and it has ARTICLE_NUMBER and NEWCOLUMN columns. Also, I have another table called B that has ARTICLENUMBER and EVENT columns. I want to execute an update statement for my NEWCOLUMN Column.
If EVENT at Table B is NULL, my NEWCOLUMN column should be 0 and if EVENT at Table B is NOT NULL, my NEWCOLUMN column should be 1.
I've tried the following, but unfortunately it didn't work;
UPDATE A a
INNER JOIN B b
ON a.ARTICLENUMBER = b.ARTICLENUMBER
SET
a.NEWCOLUMN = CASE WHEN b.EVENT IS NULL THEN 0
WHEN b.EVENT IS NOT NULL THEN 1
END;
Can someone maybe help me?