查询表中重复值

来源:互联网 发布:网络尖刀官网 编辑:程序博客网 时间:2024/05/17 23:01

查询表中相同记记录

 

select a from table where a in (select a from table group by a having count(a) >1 )

 

删除表中多余的重复记录

 

delte from table where a in (select a from table group by a having count(a) >1) and rowid not in(select min(rowid) from table group by a having count(a) >1)

 

查询表中多个字段相同的记录

 

select * from table where (a,b) in (select a,b from table group by (a,b) having count(*) >1 )

 

查询表中多个字段相同的多余的记录

 

delete from table where (a,b) in (select a,b from table group by (a,b) having count(*) >1) and rowid not in(select min(rowid) from table group by (a,b) having count(*) >1)

原创粉丝点击