日期:2014-05-17 浏览次数:20862 次
create table t1 (AA varchar2(20), BB varchar2(10), CC number(3)); insert into t1 values ('jack','A',80); insert into t1 values ('rose','B',60); insert into t1 values ('lucy','C',70); insert into t1 values ('lili','A',95); insert into t1 values ('lei','B',85); insert into t1 values ('doufu','C',75); commit; select wm_concat(decode(rn,1,aa,null)) AA,wm_concat(decode(rn,1,bb,null)) bb,wm_concat(decode(rn,1,cc,null)) cc, wm_concat(decode(rn,2,aa,null)) AA1,wm_concat(decode(rn,2,bb,null)) bb1,wm_concat(decode(rn,2,cc,null)) cc1, wm_concat(decode(rn,3,aa,null)) AA2,wm_concat(decode(rn,3,bb,null)) bb2,wm_concat(decode(rn,3,cc,null)) cc2 from (select AA,BB,CC,rownum rn from t1 where rownum<=3) AA BB CC AA1 BB1 CC1 AA2 BB2 CC2 ----------------------------- 1 jack A 80 rose B 60 lucy C 70