Author: Arun Raj
Posted: Wed Dec 14, 2016 8:42 pm (GMT 5.5)
Nitin,
Welcome to the forums!
I have not touched DB2 in a while, but should n't we be checking for something like this? This is not tested either and does n't take care of the order.
It might help if the OP can post the structure of both the tables (relevant columns) and some sample data too.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard
Posted: Wed Dec 14, 2016 8:42 pm (GMT 5.5)
Nitin,
Welcome to the forums!
I have not touched DB2 in a while, but should n't we be checking for something like this? This is not tested either and does n't take care of the order.
Code: |
SELECT T1.ID, VALUE(T2.CODE,'X') FROM TABLE1 T1 LEFT JOIN (SELECT ID,CODE FROM TABLE2 WHERE CODE IN ('A','B','C','D')) T2 ON T1.ID = T2.ID |
It might help if the OP can post the structure of both the tables (relevant columns) and some sample data too.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard