真空泵汽水分离器作用:在线急等sql问题

来源:百度文库 编辑:查人人中国名人网 时间:2024/05/11 03:52:40
库结构如下
x y z
1 aa d
2 aa d
3 ff e
5 aa e
要删除y列和z列相等的数据
好比要删除1和2两列中的一列,我说的是1和2的y列和z列分别相等,不是y=z,或者说是y列和z列同时重复.但要保留一条记录

如果x列是不重复的,那么可以:
delete from ... A
where exists (select 1 from .. B where B.y=A.y and B.z=A.z and B.x<A.x)

delete 表名 where y = z

delete from table where y=z