我见过
name col
1 2,3,4,5
查出
name col
1 2
1 3
1 4
1 5
的,是用正则表达式实现的:
select name, regexp(col,'[^,]+',1,level) col from table_name connect by level < 5
你的题目可以直接套用:
select name, regexp(col,'[^,]+',1,level) col from (select name ,age||','||C||','||D||','||E col) a connect by level < 5
SQL> select * from test;
NAME AGE C D E
---- --- -- -- --
1 2 3 4 5
SQL> select name,age from test
2 union all
3 select name,c from test
4 union all
5 select name,d from test
6 union all
7 select name,e from test;
NAME AGE
---- ---
1 2
1 3
1 4
1 5
SQL>
满意请采纳
select * from
(
select name,age from table
union all
select name,C from table
union all
select name,D from table
union all
select name,E from table
) as a
where a.name=条件
order by a.name