基于原始记录

时间:2016-03-29 11:47:42

标签: sql oracle

我有一张包含单一记录的表,想要像这样显示。

create table test
(
a number(10),
b number(10),
c number(10),
d number(10),
e number(10),
f number(10)
);
insert into test VALUES (5,3,1,4,2,6);

OutPut:

C E B D A F

1 2 3 4 5 6

1 个答案:

答案 0 :(得分:1)

select LISTAGG(q, ', ') WITHIN GROUP (ORDER BY q asc) result from (
select a q from test union select b  q  from test
union
select c q  from test
union 
select d q  from test
union 
select e  q from test
union 
select f  q from test) ;