I have a Cars
table and used this query to select a row with MaxSpeed = 200
condition:
SELECT TOP 1 *
FROM Cars
WHERE MaxSpeed = 200
ORDER BY [ID] DESC;
This query works very well, but now I need to store this row ID to a variable. I can declare an int variable, but I don't know how can get this row ID.
DECLARE @id AS INT;