3
我想刪除滿足某些條件的表中的最後一行。tsql - 刪除最後一行
DELETE TOP 1 FROM SOME_TABLE
WHERE SOME_COULMN = @VALUE
ORDER BY 1 DESC
我想刪除滿足某些條件的表中的最後一行。tsql - 刪除最後一行
DELETE TOP 1 FROM SOME_TABLE
WHERE SOME_COULMN = @VALUE
ORDER BY 1 DESC
DELETE FROM SOME_TABLE
WHERE UNIQUE_ID =
(SELECT TOP 1 UNIQUE_ID
FROM SOME_TABLE
WHERE SOME_COLUMN = @VALUE
ORDER BY SOMETHING DESC)
DELETE和UPDATE語句需要的行參數的數目括號()
DELETE TOP (1) FROM SOME_TABLE WHERE SOME_COULMN = @VALUE ORDER BY 1個DESC
顛倒你的訂單並刪除第一個? – Andrew 2010-02-12 11:17:47