--一條語句刪除表中相同的記錄
--測試數據
Declare @ Table
(
id int identity,
sName varchar(10)
)
Insert into @ Select '張三'
Insert into @ Select '王二'
Insert into @ Select '張三'
Insert Into @ Select '李四'
Insert into @ Select '王二'
Delete from @
where not id in (select Max(id) from @ Group by sName)
Select * from @