日期:2014-05-17 浏览次数:20723 次
with t1 as
(
select 1 c1,'a' c2 from dual union all
select 2 c1,'b' c2 from dual union all
select 3 c1,'c' c2 from dual union all
select 4 c1,'d' c2 from dual union all
select 5 c1,'e' c2 from dual union all
select 6 c1,'f' c2 from dual union all
select 7 c1,'g' c2 from dual
)
select rn,replace(wm_concat(c2),',','') c2
from
(
select c2,
case mod(rownum,3) when 2 then (rownum+1)/3
when 1 then (rownum+2)/3
when 0 then rownum/3 end rn
from t1
)
group by rn
order by rn
c2 rn
--------------------------
1 1 abc
2 2 def
3 3 g
with t as
(select 1 c1, 'a' c2
from dual
union all
select 2 c1, 'b' c2
from dual
union all
select 3 c1, 'c' c2
from dual
union all
select 4 c1, 'd' c2