--查找重复数据
select *
from canteen_book a
where (a.name, a.booktime,a.type) in (select name, booktime,type
from canteen_book
group by name, booktime,type
having count(*) > 1)
----删除重复数据
delete from canteen_book a
where (a.name, a.booktime,a.type) in (select name, booktime,type
from canteen_book
group by name, booktime,type
having count(*) > 1)
and rowid not in (select min(rowid)
from canteen_book
group by name, booktime,type
having count(*) > 1)
适用于部分重复
上面查询 下面删除
name, booktime,type 假设三个字段有重复
阅读(2362) | 评论(0) | 转发(0) |