Quantcast
Channel: IBM Mainframe Computers Forums
Viewing all articles
Browse latest Browse all 8500

DB2 :: RE: SQL query to run through list of values in table

$
0
0
Author: Arun Raj
Posted: Thu Dec 15, 2016 1:12 am (GMT 5.5)

Rohit,

Yes, that was an assumption I made that all table1 IDs are available in the second table unless the OP has stated otherwise, or what he wants in such a scenario.

Apart from that, the interpretations are different here. My understanding was like this, the OP can clarify if it is incorrect.

Let's say an ID=ID1 has the CODEs A,B,C,E,F. Since it has ANY one of the 'valid' IDs, my output will have only these:
Code:
ID1 A
ID1 B
ID1 C

Let's say another ID=ID2 has the CODEs E,F,G,H since none of them falls in the list of 'valid' CODEs, so the output will have these:
Code:
ID2 X

I see your code will give this for Case1:
Code:
ID1 A
ID1 B
ID1 C
ID1 X
ID1 X
I'd wait for the OP to clarify the requirement before we proceed any further.
_________________
Arun
----------------------------------------------------------------------------------------------------
Love is like an hourglass, with the heart filling up as the brain empties. -Jules Renard


Viewing all articles
Browse latest Browse all 8500

Trending Articles