日期:2014-05-17 浏览次数:20771 次
delete from t1 a
where a.number = 0
and a.name in
(select name from t1 group by name having count(1) > 1);
DELETE FROM T1 WHERE T1.NUM=0 AND EXISTS(SELECT 1 FROM T1 T2 WHERE T1.NAME=T2.NAME AND T2.NUM<>0)
--删除而留一条name相同的记录
delete from t1
where rowid in (select rid
from (select name,
row_number() over(partition by name order by number desc) as rn,
rowid as rid
from t1)
where rn > 1)
and number = 0;
DELETE FROM t1 WHERE NUMBER=0 AND NAME IN
(SELECT NAME FROM t1 GROUP BY NAME HAVING COUNT(1)>1)