我想从表中删除满足某些条件的最后一行。
DELETE TOP 1 FROM SOME_TABLE
WHERE SOME_COULMN = @VALUE
ORDER BY 1 DESC
答案 0 :(得分:5)
DELETE FROM SOME_TABLE
WHERE UNIQUE_ID =
(SELECT TOP 1 UNIQUE_ID
FROM SOME_TABLE
WHERE SOME_COLUMN = @VALUE
ORDER BY SOMETHING DESC)
答案 1 :(得分:-1)
DELETE和UPDATE语句需要括号()表示行数参数
DELETE TOP (1) FROM SOME_TABLE 在哪里SOME_COULMN = @VALUE 订购1 DESC