SQLDepot

1 query found for "Distribution Code Language"

Retrieve Distribution Codes

select a.dst_id,z.descr,a.effdt,df.gl_acct,
(select char_val from ci_dst_cd_char c where c.chaR_type_cd='GLFUNCT' and c.dst_id=a.dst_id
        and effdt=(select max(effdt) from ci_dst_cd_char b where b.dst_id=c.dst_id and b.char_type_cd=c.char_type_cd)) gl_funct,
(select char_val from ci_dst_cd_char c where c.chaR_type_cd='GLACCTYP' and c.dst_id=a.dst_id
        and effdt=(select max(effdt) from ci_dst_cd_char b where b.dst_id=c.dst_id and b.char_type_cd=c.char_type_cd)) gl_acct_typ         
from ci_dst_cd_char a,ci_dst_code_l z ,CI_DST_CODE_EFF df
where a.effdt=(select max(effdt) from ci_dst_cd_char b where b.dst_id=a.dst_id 
and b.char_type_cd=a.char_type_cd)
and a.dst_id=z.dst_id
and df.dst_id=a.dst_id
group by a.dst_id,a.effdt,z.descr,df.gl_acct
order by dst_id
uploaded by Muhammad Junaid