将一个表中有一列为fatherID,我想把fatherID相同的数据作为一个临时表输出。输出过个表。
------解决方案--------------------
给出具体测试数据和结果
------解决方案--------------------
------解决方案--------------------
- SQL code
select *from tbwhere fatherid in ( select fatherid from tb group by fatherid having count(*) > 1)
------解决方案--------------------
- SQL code
--存在主键字段,假设为Idselect *from tb twhere exists (select 1 from tb where fatherid=t.fatherid and id<>t.id)