sql server 删除重复行

-- 删除重复的supplierName,并且保留SupplierId最大的一个
begin tran
delete T From
(Select Row_Number() Over(Partition By supplierName order By SupplierId desc) As 'rn',*
From Supplier)T
Where T.rn > 1
-- commit
-- rollback

posted @ 2020-11-04 14:57  温故纳新  阅读(175)  评论(0编辑  收藏  举报