以下是我的Oracle sql查询
Select ELP_DEALER.DEALER,
ELP_DEALER_RECON_WRK.Entire_Record
From ELP_DEALER,
ELP_DEALER_RECON_WRK
Where ELP_DEALER_RECON_WRK.Dealer_Id = ELP_DEALER.DEALER_ID
And ELP_DEALER.Dealer In ( 'CABC', 'IKBC', 'CITI', 'GNHW', '0062' )
Group By ELP_DEALER.Dealer
这里我只想要ENTIRE_RECORD字段基于DEALER的单条记录,如CABC,IKBC。请允许任何人帮助我
样本表
这是正常的输出
DEALER ENTIRE_RECORD
0068 xyz
0068 abc
cabc pqr
cabc npq
过期输出应为
DEALER ENTIRE_RECORD
0068 anyoftheonerecord
cabc anyoftheonerecord
答案 0 :(得分:1)
Select ELP_DEALER.DEALER,
MAX(ELP_DEALER_RECON_WRK.Entire_Record) ENTIRE_RECORD
From ELP_DEALER,
ELP_DEALER_RECON_WRK
Where ELP_DEALER_RECON_WRK.Dealer_Id = ELP_DEALER.DEALER_ID
And ELP_DEALER.Dealer In ( 'CABC', 'IKBC', 'CITI', 'GNHW', '0062' )
Group By ELP_DEALER.Dealer