日期:2014-05-17  浏览次数:20843 次

求高手指教SQL一杖
表:

字段: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=1
where regexp_substr(id,'[^,]+',1,n) is not null