子查詢有多筆資料時,使用wm_concat將資料合成一筆,用逗號隔開
select b.INGOT_ID,
( select wm_concat(distinct aa.chamber_id) from mes_wip_lot aa , mes_wip_comp bb
where aa.facility=bb.facility and aa.lot_no=bb.lot_no and bb.SUB_TYPE='PROD'
and b.facility=aa.facility and b.ingot_id=bb.ingot_id) Chamber_A
from whm2010 b
where b.REC_DATE = '20200804'