查找数据库表A的x列的重复数据,条件是y列数据等于0,求大神指点,有删除的语句的话请大神一起列出来
2条回答
- 董哥888888 2016-09-24 04:07关注
查询出 x 列有重复数据的 x 列的值来;
select x,count(id) from A where y='0' group by x having count(id)>1;
根据查询 结果 就可以知道 那些x 列的值有重复了;select * from A where y='0' and x in(
select x from A where y='0' group by x having count(id)>1
)
这样就可以 看到重复数据了;
再下面就根据实际数据情况 看看怎么删除了解决 无用评论 打赏 举报