一条DELETE语句
(编辑:jimmy 日期: 2024/11/24 浏览:3 次 )
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;
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;
下一篇:sql 中将日期中分秒化为零的语句