SELECT
v.字段2,
v.字段1
FROM
(
SELECT
字段2 AS 字段2,
substr(
REPLACE ( 字段1, ',', ',' ),
l,
instr( REPLACE ( 字段1, ',', ',' ) || ',', ',', l ) - l
) AS 字段1
FROM
(
SELECT
v.字段2 AS 字段2,
v.字段1 AS 字段1
FROM
table v
WHERE v.字段1 is not null
HAVING
count( 1 ) >= 1
GROUP BY
v.字段2,
v.字段1
) A,
(
SELECT LEVEL
l
FROM
DUAL CONNECT BY LEVEL <= (
SELECT
max( ( length( 字段1 ) ) - LENGTH( REGEXP_REPLACE ( REPLACE ( 字段1, ',', '@' ), '[^@]+', '' ) ) )
FROM
table
)
)
WHERE
substr( ',' || REPLACE ( 字段1, ',', ',' ), l, 1 ) = ','
) v
LEFT JOIN table a ON a.字段2= v.字段2
|