标签: mysql
有谁知道如何获得SCId出现两次相同数字的行?
答案 0 :(得分:0)
一种方法是通过加入子查询来过滤掉非匹配记录,该子查询会查找表中出现两次的所有匹配SCId值。
SCId
SELECT t1.* FROM yourTable t1 INNER JOIN ( SELECT SCId FROM yourTable GROUP BY SCId HAVING COUNT(*) = 2 ) t2 ON t1.SCId = t2.SCId;