안녕하십니까? 다음의 데이터를 가로로 변경하고 싶습니다.
customer
========
4504392328q
4504392328
다음과 같이 바꾸고 싶습니다.
4504392328q, 4504392328
생각만큼 안되네요....
SELECT REPLACE( SUBSTR (MAX (SYS_CONNECT_BY_PATH(customer_po, ',') ), 2),', ','') customer_po
FROM (SELECT distinct O.BUYERPO customer_po
FROM ORDERDETAIL OD,
ORDERS O,
( SELECT ORDERGROUP, SOURCEKEY, id, SKU
FROM (
SELECT ORDERGROUP, SOURCEKEY, id, SKU
FROM LOTXIDDETAIL
WHERE ORDERGROUP = '53619'
AND ID = '53619-001'
AND IOFLAG = 'O'
)
GROUP BY ORDERGROUP, SOURCEKEY, id, SKU
) L
WHERE OD.ORDERKEY = O.ORDERKEY
AND O.ORDERGROUP = L.ORDERGROUP
AND O.ORDERKEY = L.SOURCEKEY
AND OD.SKU = L.SKU
AND O.ORDERGROUP = '53619' )
START WITH 1 = 1
CONNECT BY PRIOR 1 = 1 -1
조언부탁 드립니다.
감사합니다. |