删除重复的数据

1
2
3
4
5
6
7
delete a from tb_dict a
where (a.keyword,a.nature) in (
select * from (select keyword,nature from tb_dict group by keyword, nature having count(*) > 1) b
)
and a.id not in (
select * from (select min(id) from tb_dict group by keyword, nature having count(*)>1) c
)

查询重复的数据

1
2
3
4
select * from tb_dict a 
where (a.keyword,a.nature, a.freq) in (
select keyword,nature, freq from tb_dict group by keyword, nature, freq having count(*) > 1
)