我做了下面这样的测试可以但要建立一个与你要找的表结构相同的表存放相同数据
下面是我的测试不知道可不可以
create table test1(col_a varchar2(10),col_b varchar2(10),col_c varchar2(10),col_d varchar2(10),col_e varchar2(10),col_f varchar2(10));
SQL> select * from test1;
COL_ACOL_BCOL_CCOL_DCOL_ECOL_F
---------- ---------- ---------- ---------- ---------- ----------
a
b
c
d
e
f
b
c
d
e
f
a
c
d
e
f
a
b
d
e
f
a
b
c
e
f
a
b
c
d
f
a
b
c
d
e
a
b
c
d
e
f
create table test2 as select * from test1 where rownum str_rowid);
commit;
fetch test_rowid into str_rowid;
end loop;
end;
查看表test2
SQL> select * from test2;
COL_ACOL_BCOL_CCOL_DCOL_ECOL_F
---------- ---------- ---------- ---------- ---------- ----------
a
b
c
d
e
f
a
b
c
d
e
f
不知道这样可不可以
好久沒上了,就來回個貼吧。
select empno,ename from emp
where rowid != (select max(rowid) from emp d where emp.ename = d.ename and emp.empno = d.empno)
自己根據自己的需要修改吧。