I have two columns Col1, Col2 from Table1 in database DB1. Col1 contains data and Col2 is all null. I have a column Col3 which comes from a query on Table2 in another database DB2. I want to set Col2 based on the following condition -
If a row of Col1 EQUAL TO any of the rows in Col3, then set Col2 EQUAL TO row of Col3. ELSE, set it EQUAL TO Col1. Its weird, but I need to do it.
Example -
Col3 is ALWAYS = {Aaa, RTY, Ccc, DART, Car, Fish, SPOON}
Col1,Col2,Col3
Aaa, null, Aaa
Bbb, null, RTY
Ccc, null, Ccc
...
How to make a query which will give us the result below ?
Col1,Col2,Col3
Aaa, Aaa, Aaa
Bbb, Bbb, RTY
Ccc, Ccc, Ccc
...