我想把t1中a列重复的删掉,于是我建立了表t2,create table t2 as select distinct(a) from t1
SQL> select * from t1
2 /
A B C D
---------- ---------- ---------- ----------
1 2 3 2
2 3 2 1
1 2 2 2
SQL> select * from t2
2 /
A
----------
1
2
SQL> delete from t1 where rowid=(select max(rowid) from t1 where t1.a=t2.a)
2 /
delete from t1 where rowid=(select max(rowid) from t1 where t1.a=t2.a)
*
ERROR 位于第 1 行:
ORA-00904: "T2"."A": 无效的标识符
我怎么才能把t1中a列重复的列删掉呢
SQL> select * from t1
2 /
A B C D
---------- ---------- ---------- ----------
1 2 3 2
2 3 2 1
1 2 2 2
SQL> select * from t2
2 /
A
----------
1
2
SQL> delete from t1 where rowid=(select max(rowid) from t1 where t1.a=t2.a)
2 /
delete from t1 where rowid=(select max(rowid) from t1 where t1.a=t2.a)
*
ERROR 位于第 1 行:
ORA-00904: "T2"."A": 无效的标识符
我怎么才能把t1中a列重复的列删掉呢
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8135069/viewspace-136060/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8135069/viewspace-136060/
本文介绍了一种从SQL表t1中删除重复记录的方法,通过创建另一个表t2来存储不重复的数据,并探讨了如何进一步操作以实现目标。
1003

被折叠的 条评论
为什么被折叠?



