Taking the second last row with only one select in SQL Server?

To get the 2nd last row in one select:

SELECT TOP 1 * From
(select Top 2 * from Cinema ORDER BY CinemaID DESC) x                     
ORDER BY CinemaID

It’s really only “one” select because the outer select is over only 2 rows.

Leave a Comment