------解决方案-------------------- select a.*,b.list from style a left join goods b on a.type=b.type ------解决方案-------------------- 你的数量是从哪个列得到的 ------解决方案--------------------
WITH A AS(
SELECT 1 AS ID, 'NK09' AS TYPE,'test1' AS NAME FROM DUAL UNION ALL
SELECT 2 AS ID, 'NK10' AS TYPE,'test2' AS NAME FROM DUAL UNION ALL
SELECT 3 AS ID, 'Nk22' AS TYPE,'test3' AS NAME FROM DUAL
), B AS(
SELECT 1 AS ID,1 AS TYPE,'洗脸盆' AS LIST FROM DUAL UNION ALL
SELECT 2 AS ID,1 AS TYPE,'毛巾' AS LIST FROM DUAL UNION ALL
SELECT 3 AS ID,1 AS TYPE,'小毛巾' AS LIST FROM DUAL UNION ALL
SELECT 4 AS ID,3 AS TYPE,'绳子' AS LIST FROM DUAL
)
SELECT ID,TYPE,NAME,TO_CHAR(WMSYS.WM_CONCAT(N))
FROM
(
SELECT A.ID,A.TYPE,A.NAME,B.LIST ------解决方案-------------------- '(' ------解决方案-------------------- COUNT(LIST) OVER(PARTITION BY LIST) ------解决方案-------------------- ')' AS N
FROM A,B
WHERE A.ID = B.TYPE
)
GROUP BY ID,TYPE,NAME