tags:

views:

28

answers:

1

I want to delete the last row from the table that satisfies some condition.

DELETE TOP 1 FROM SOME_TABLE
WHERE SOME_COULMN = @VALUE
ORDER BY 1 DESC
A: 
DELETE FROM SOME_TABLE
WHERE UNIQUE_ID = 
(SELECT TOP 1 UNIQUE_ID
FROM SOME_TABLE
WHERE SOME_COLUMN = @VALUE
ORDER BY SOMETHING DESC)
Chris Latta