今天業(yè)務(wù)需要,網(wǎng)上沒找到 最后寫出來了就留個印以備查閱
#T1表中 A,B 列 至少三行都相同的數(shù)據(jù)
SELECT * FROM #T1 t1 WHERE
(
SELECT COUNT(*) FROM(
SELECT DISTINCT A,B FROM #T1 WHERE A=t1.A
) A
)=1
AND (SELECT DISTINCT COUNT(ID) FROM #T1 WHERE A=t1.A)>=3
ORDER BY t1.A
更多信息請查看IT技術(shù)專欄