关于1对多查询
方法一:通过to_char(wm_concat(列名)) 再后台解析数据
SELECT
DISTINCT
t.ID,
to_char(wm_concat(t.SUPPLIER_ENCLOSURE_FILE_ID)) as LINK_SUPPLIER_FILE_ID,
to_char(wm_concat(t.EXPERT_ENCLOSURE_FILE_ID)) as LINK_EXPERT_FILE_ID,
to_char(wm_concat(t.SUPPLIER_ENCLOSURE_NAME)) AS SUPPLIER_ENCLOSURE_NAME_ARR,
to_char(wm_concat(t.EXPERT_ENCLOSURE_NAME)) AS EXPERT_ENCLOSURE_NAME_ARR
FROM
(
SELECT
a.ID,
a.ISSUE_ID,
a.REQUIRED_TEST_UNIT,
a.SUB_RECTIFICATION_ID,
a.ROUND,
a.SELECT_STATUS,
a.EXPERT_DESC,
a.ARRANGED_EXPERT_ID,
a.CHECK_STATUS,
a.REMARK,
a.CREATE_USER,
a.SUB_DETAIL_ID,
a.OTHER_REASON,
a.CREATE_TYPE,
a.QUALITY_PROMISE,
a.SERVICE_PROMISE,
a.DELIVERY_PROMISE,
a.INTEGRITY_PROMISE,
b.REASON_NAME,
c.SECOND_DESC,
c.SOLUTION_NAME,
c.SUPPORT_DESC,
d.ENCLOSURE_NAME as SUPPLIER_ENCLOSURE_NAME,
d.ID as SUPPLIER_ENCLOSURE_FILE_ID,
d.ENCLOSURE_CONTENT as SUPPLIER_ENCLOSURE_CONTENT,
f.ENCLOSURE_NAME as EXPERT_ENCLOSURE_NAME,
f.ID as EXPERT_ENCLOSURE_FILE_ID,
f.ENCLOSURE_CONTENT as EXPERT_ENCLOSURE_CONTENT
FROM
W.IO_MATCH a
LEFT JOIN W.IO_SUB_RECTIFICATION b ON a.SUB_RECTIFICATION_ID = b.ID
LEFT JOIN W.IO_SUB_DETAIL c ON a.SUB_DETAIL_ID = c.ID
LEFT JOIN W.IO_ISSUE s ON s.UUID = a.ISSUE_ID
left JOIN W.IO_ENCOSURE d ON d.ISSUE_ID = a.ID AND d.ENCLOSURE_TYPE = '3'
LEFT JOIN W.IO_ENCOSURE f ON f.ISSUE_ID = a.ID AND f.ENCLOSURE_TYPE = '4'
WHERE
a.ISSUE_ID = 'issue0001'
AND a.round = s.round
) t
GROUP BY t.ID
方法二:
参考:https://www.cnblogs.com/longxok/p/10905975.html