SQL Server數據庫多種方式查找重復記錄:
示例
建該表的Sql語句如下
CREATE TABLE [StuInfo] (
[recno] [int] IDENTITY (
[stuid] [varchar] (
[stuname] [varchar] (
) ON [PRIMARY]
GO
例如:查找stuid
select stuid
group by stuid
having(count(*))>
例如:查找stuid重復的記錄
select * from stuinfo
where stuid in (
select stuid from stuinfo
group by stuid
having(count(*))>
)
前提
例如:查找stuid重復的記錄
select * from stuinfo s
where recno not in (
select max(recno) from stuinfo s
where s
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22365.html