1
我已經使用內部連接加入了兩個表。這裏表TPREG
的主鍵是co_id
和pol_id
加入Db2查詢
SELECT (SELECT etbl_desc_txt
FROM uding604.tedit e
WHERE etbl_typ_id = 'PITCD'
AND co_id = 'CP'
AND etbl_valu_id = p.pol_ind_typ_cd) pol_ind_typ_cd,
(SELECT etbl_desc_txt
FROM uding604.tedit e
WHERE etbl_typ_id = 'PAYT'
AND co_id = 'CP'
AND etbl_valu_id = p.POL_BILL_TYP_CD) POL_BILL_TYP_CD,
POL_PAC_DRW_DY,
(SELECT etbl_desc_txt
FROM uding604.tedit e
WHERE etbl_typ_id = 'PAYM'
AND co_id = 'CP'
AND etbl_valu_id = p.POL_BILL_MODE_CD) POL_BILL_MODE_CD,
t.SOURCE_CD
FROM uding604.tpol p,
uding604.TPREG t
WHERE p.co_id = t.co_id
AND p.pol_id = t.pol_id
AND p.co_id = 'CP'
AND p.pol_id = '000000011'
AND t.co_id = 'CP'
AND t.pol_id = '000000011'
如何讓這個查詢更簡單嗎?
請指導。