列转行
with t1 as (–项目方
select o_code,wm_concat(p_code) from TOBJ_ASSET_ISSUER t where t.i_type=‘4’
group by o_code),
–存款银行
t2 as (select o_code,wm_concat(p_code) from TOBJ_ASSET_ISSUER t where t.i_type=‘8’
group by o_code)
select t.b_fullname,t.qxr,t.dqr,t2.o_code,t1.o_code from tdeposit_agreement t
left join t1 on t.o_code=t1.o_code
left join t2 on t.o_code=t2.o_code