刪除table中的重複紀錄

ALTER TABLE admin ADD NewID int IDENTITY (1, 1)
go

DELETE FROM admin WHERE EXISTS
(SELECT 1
FROM admin a
WHERE a.newid > admin.newid AND
admin.uid = a.uid AND
admin.uname = a.uname AND
admin.upass a.upass AND
admin.udep = a.udep)
go

ALTER TABLE admin DROP COLUMN NewID
go


你可能感兴趣的:(table)