Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

select query result set

$
0
0
Hi,
I just want the common rows(FIRST_NO) which are in

PL_PLA ='BBB' AND PL_PLA='CCC'

which should not in other PL_PLA rows

DB2 9.1 Z/OS

Code:


SELECT
 T1.PL_PLA
,T1.FIRST_NO
,T1.FLT_SHT

FROM BASE_TABLE T1

WHERE

T1.PL_PLA in ('BBB','CCC')




BASE TABLE

PL_PLA FIRST_NO FLT_SHT
R23    322      IEMC
1EE    444      FDDD 
AAA    111      QQQQ
AAA    222      WWWW
BBB    111      REEE
BBB    222      WSQQ
BBB    333      EWDG
CCC    111      EEDD
CCC    222      EWDQ
CCC    444      UKCL
DDD    111      DDDD
DDD    222      VVVV
EEE    111      EWEW
 
ACTUAL RESULT SET GETTING

PL_PLA FIRST_NO FLT_SHT
BBB    111      REEE
BBB    222      WSQQ
BBB    333      EWDG
CCC    111      EEDD
CCC    222      EWDQ
CCC    444      UKCL
EXPECTED RESULT SET

PL_PLA FIRST_NO FLT_SHT

BBB    111      REEE
BBB    222      WSQQ
CCC    111      EEDD
CCC    222      EWDQ


Thanks,

Viewing all articles
Browse latest Browse all 13329

Trending Articles