29. 查询某个字段重复的记录

Posted on 2016-06-07 10:33  zkx4213  阅读(125)  评论(0编辑  收藏  举报

这里是查询tcalendar表ID值相同的记录

select * from tcalendar where id in (
  select id from tcalendar t where t.id in (
    select t1.id from tcalendar t1 group by t1.id having count(*) >1
  )
) order by id asc

Copyright © 2024 zkx4213
Powered by .NET 8.0 on Kubernetes