首页 > 数据库 > 数据库开发技术 > itpub上一个sql问题
hnroger给的答案:
唉,我怎么想不到哪?
test@anhorcl> create table t1
2 (new varchar2(4),
3 acc_nbr number(6))
4 /
test@anhorcl>insert into t1 values('new6',123456)
test@anhorcl>insert into t1 values('new6',264655);
test@anhorcl>insert into t1 values('new7',246333)
test@anhorcl>insert into t1 values('new7',164655);
test@anhorcl> ed
Wrote file afiedt.buf
1 select a.new,a.acc_nbr,b.new,b.acc_nbr from
2 (select rownum rw,t1.* from t1 where new='new6') a,
3 (select rownum rw,t1.* from t1 where new='new7') b
4* where a.rw=b.rw
SYSTEM@anhorcl> /
NEW ACC_NBR NEW ACC_NBR
-------- ---------- -------- ----------
new6 123456 new7 246333
new6 264655 new7 164655
Elapsed: 00:00:00.01
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/77861/viewspace-837331/ ,如需转载,请注明出处,否则将追究法律责任。