美文网首页php
删除表中身份证重复的数据

删除表中身份证重复的数据

作者: 落魄PHP女程序员 | 来源:发表于2018-07-26 11:27 被阅读0次

    delete from blacklist where card_no in(select * from (select card_no from blacklist group by card_no having count(card_no) > 1) aa)

    and id not in (select * from (select min(id) from blacklist group by card_no having count(card_no )>1) bb)

    子查询中要给别名。不然就会报错

    相关文章

      网友评论

        本文标题:删除表中身份证重复的数据

        本文链接:https://www.haomeiwen.com/subject/xgivmftx.html