This is an updated version of questions posted by me before
(SQL update/set more than one column 7/30/07 and SQL update logic 7/28/07).
I hope this version is clear.
I have four tables:
Table1, Table2, Table3, and Table4
Table1 and Table2 have common column id. Table2 has columns that can be matched with columns in Table3 and Table4.
I need to join Table1 and Table2 and update column in Table1 depending on different conditions
(1) when Table2.colA = Table3.ColA and Table2.colB = Table3.ColB Then 1 (set to 1 if a match and dont check anything else)
(2) when Table2.colA=Table4.ColA and Table2.colB = Table4.ColB Then 2 (set to 2 if a match and dont check anything else)
If there is no match for when (1) and when (2) then set the value to 3.