Author: Arun Raj
Posted: Wed Dec 14, 2016 8:42 pm (GMT 5.5)
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)
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 A.ID, VALUE(B.CODE,'X') FROM TABLE1 T1 LEFT JOIN (SELECT ID,CODE FROM TABLE2 WHERE CODE IN ('A','B','C','D')) T2 WHERE 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