sqlserver 删除重复数据,保留一条

sqlserver 删除重复数据,保留一条

查询重复数据

select * From
(Select Row_Number() Over(Partition By [Mnumber] order By [Mnumber]) As RowNumber,* From MCCESS)T
Where T.RowNumber > 1

删除重复数据

Delete T From
(Select Row_Number() Over(Partition By [Mnumber] order By [Mnumber]) As RowNumber,* From MCCESS)T
Where T.RowNumber > 1

你可能感兴趣的:(数据库,sqlserver,数据库,sql)