Oracle SQL语句,符合条件的数据在表中存在一条时不列出,当有两条以上时才列出结果

2025-03-23 01:16:23
推荐回答(3个)
回答1:

select a.* from table a,table b
where a.id = b.id and a.no b.no
and a.id in (select a.id from table a,table c where a.id=c.id group by a.id having count(*)>2)

你这三个表是同一个表不?

还是你为了简单都写成table了?

还有等于2条的怎么办?

回答2:

按你的同类信息分组 group by having count(*)>1

回答3:

使用group by having count(*)>1