sql 查找重复数据,并且重复数据有子集

SELECT A.* FROM comm_department A
INNER JOIN
(
select  path,count(*) as count from comm_department group by path having count>1
) B ON B.path=A.path
WHERE  EXISTS(SELECT * FROM comm_department C WHERE C.parent_id=A.id)

  

posted @ 2019-06-11 14:51  八英里  阅读(443)  评论(0编辑  收藏  举报