一条DELETE语句
发布时间:2016-12-28 来源:查字典编辑
摘要:WITHwAS(SELECTId,ROW_NUMBER()OVER(ORDERBYIdDESC)AS[Row]FROM[t1]WHERECo...
WITH w AS(
SELECT Id,ROW_NUMBER() OVER(ORDER BY Id DESC) AS [Row]
FROM [t1]
WHERE Code=@Code
)
DELETE FROM t1 FROM t1 s INNER JOIN w ON s.Id=w.Id
WHERE w.Row>100;