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;
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/tech/database/236582.html
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;
原创文章,作者:6024010,如若转载,请注明出处:https://blog.ytso.com/tech/database/236582.html