天天看點

SqlServer 查詢資料重複

SQL Server 查詢資料重複

1、查詢單列重複

select * from test
where name in (select name from test group by name having count
(name) > 1)      

2、查詢多列重複

SELECT a.* FROM test a,(
SELECT name,code
FROM test 
GROUP BY name,code
HAVING COUNT(1)>1
 
) AS b
WHERE a.name=b.name AND a.code=b.code      

————————————————

優秀不夠,你是否無可替代

軟體測試交流QQ群:721256703,期待你的加入!!

歡迎關注我的微信公衆号:軟體測試君

SqlServer 查詢資料重複