表:
字段:NAME ID
AAA 1,2,3
BBB 1,2
结果:
NAME ID
AAA 1
AAA 2
AAA 3
BBB 1
BBB 2
------解决方案--------------------
把下面的表名test_a换成你自己的表名即可:
- SQL code
select name,regexp_substr(id,'[^,]+',1,n) from test_a left join (select level,rownum n from dual connect by level < 10) on 1=1where regexp_substr(id,'[^,]+',1,n) is not null