Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Self Join result weird

New Contributor

Hi all,

Kindly please advise accordingly on self join query..

 

Query 1. Got result returned

select af.source_system_id, af.ar_id, bf.ar_id as ar_id_old, af.eff_dt as eff_dt_new, bf.eff_dt as eff_dt_old
from
gr_my_mpa.ar_x_ar_x_ip_x_pd bf inner join
gr_my_mpa.ar_x_ar_x_ip_x_pd af on bf.ip_id = af.ip_id and bf.sbj_ar_id = af.ar_id and bf.ar_id <> af.ar_id and bf.ar_id < af.ar_id
WHERE bf.ar_x_ar_tp_id = '101102' AND bf.SOURCE_SYSTEM_ID = 'SIBSMY' and bf.REGULATORY_PRODUCT_GROUPING = 'AUTOLOAN' AND bf.INDV = '1'
AND af.SOURCE_SYSTEM_ID = 'SIBSMY' and af.REGULATORY_PRODUCT_GROUPING = 'AUTOLOAN' AND af.INDV = '1'

 

Query 2. No result returned just only added additional field at select there -> af.unq_id_src_stm

select af.source_system_id, af.ar_id, bf.ar_id as ar_id_old, af.eff_dt as eff_dt_new, bf.eff_dt as eff_dt_old, af.unq_id_src_stm
from
gr_my_mpa.ar_x_ar_x_ip_x_pd bf inner join
gr_my_mpa.ar_x_ar_x_ip_x_pd af on bf.ip_id = af.ip_id and bf.sbj_ar_id = af.ar_id and bf.ar_id <> af.ar_id and bf.ar_id < af.ar_id
WHERE bf.ar_x_ar_tp_id = '101102' AND bf.SOURCE_SYSTEM_ID = 'SIBSMY' and bf.REGULATORY_PRODUCT_GROUPING = 'AUTOLOAN' AND bf.INDV = '1'
AND af.SOURCE_SYSTEM_ID = 'SIBSMY' and af.REGULATORY_PRODUCT_GROUPING = 'AUTOLOAN' AND af.INDV = '1'

 

If Query 2, using select * then got result returned

or trim all the condition fields also will get result returned 

 

Thanks & Regards

 

 

 

0 REPLIES 0
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.