select t1.xm,t1.value,t2.xm,t2.value,t3.xm,t3.value,t4.xm,t4.value,
(select rownum id,t.xm,t.value 
from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=0) t1,
(select rownum id,t.xm,t.value 
from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=0) t2,
(select rownum id,t.xm,t.value 
from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=0) t3,
(select rownum id,t.xm,t.value 
from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=0) t4
where t1.id=t2.id and t2.id=t3.id and t3.id=t4.id;

解决方案 »

  1.   

    楼上的还忽略了一点,万一不是整数倍呢?岂不是会漏掉几个。最好用left join
      

  2.   

    sorry;select t1.xm,t1.value,t2.xm,t2.value,t3.xm,t3.value,t4.xm,t4.value,
    (select rownum id,t.xm,t.value 
    from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=0) t1,
    (select rownum id,t.xm,t.value 
    from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=1) t2,
    (select rownum id,t.xm,t.value 
    from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=2) t3,
    (select rownum id,t.xm,t.value 
    from (select rownum id,tbname.* from tbname) t where mod(t.id,4)=3) t4
    where t1.id=t2.id and t2.id=t3.id and t3.id=t4.id;
      

  3.   

    select decode(mod(substr(xm,2),4),1,xm||value),decode(mod(substr(xm,2),4),2,xm||value),decode(mod(substr(xm,2),4),3,xm||value),decode(mod(substr(xm,2),4),0,xm||value)
    from tab