select sys_guid() as id, 'SEP' AS diseasetype, qybah as pat_id, 'CM-0-1-3-1' as SUBMITNAME, listagg(jg,',') within group(order by jg) as pat_value, sysdate as createtime, ''updatetime from (select distinct T.qybah, NCV2.VALUE as jg from BA_SYJBK t join ncis.BA_SYZDK a on a.syxh=t.syxh join ncis.JY_NCIS_VALUE ncv2 on (SUBSTR(a.bzbm,1,3)=SUBSTR(ncv2.REMARK,1,3)or SUBSTR(t.zyzdbm,1,5)=SUBSTR(ncv2.REMARK,1,5)) and ncv2.diseasetype='SEP' and ncv2.submitname='CM-0-1-3-1' and T.qybah='798887' AND 'SEP'='SEP' ) group by qybah |