I am using microsoft query to run SQL against some DB2 tables. I keep getting a 'AQL0206N' error. My Query is:
SELECT all*
From Grp.table1 H
inner join (SELECT CTR_I, POL_CTR_I, max(CER_PRM_EFF _D) as cer_prm_eff_d
FROM GRP.Table2
WHERE CLN_CTR_RLT_TYP _C = '03'
GROUP BY CTR_I, POL_CTR_I) as I
on i.ctr_i = h.ctr_I
and i.pol_ctr_I = h.Pol_ctr_i
and h.CER_PRM_EFF_D = I.cer_prm_eff_d
The error message refers to I.cer_prm_eff_d is not valid.
Can some one help me with my code?
SELECT all*
From Grp.table1 H
inner join (SELECT CTR_I, POL_CTR_I, max(CER_PRM_EFF _D) as cer_prm_eff_d
FROM GRP.Table2
WHERE CLN_CTR_RLT_TYP _C = '03'
GROUP BY CTR_I, POL_CTR_I) as I
on i.ctr_i = h.ctr_I
and i.pol_ctr_I = h.Pol_ctr_i
and h.CER_PRM_EFF_D = I.cer_prm_eff_d
The error message refers to I.cer_prm_eff_d is not valid.
Can some one help me with my code?