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.
More Related Contents:
- The order of a SQL Select statement without Order By clause
- Select columns from result set of stored procedure
- SQL Server: SELECT only the rows with MAX(DATE)
- What does “ORDER BY (SELECT NULL)” mean?
- SQL Server – join rows into comma separated list
- How can foreign key constraints be temporarily disabled using T-SQL?
- Does T-SQL have an aggregate function to concatenate strings? [duplicate]
- How to create materialized views in SQL Server?
- How can I clear the SQL Server query cache?
- SQL Server Random Sort
- SQL Server database backup restore on lower version
- Add a new table column to specific ordinal position in Microsoft SQL Server
- How do you specify a different port number in SQL Management Studio?
- How to set monday as first day of week in SQL Server
- How do I flush the PRINT buffer in TSQL?
- SQL Server Login error: Login failed for user ‘NT AUTHORITY\SYSTEM’
- VarBinary vs Image SQL Server Data Type to Store Binary Data?
- Drop primary key using script in SQL Server database [duplicate]
- OR Operator Short-circuit in SQL Server
- T-SQL XOR Operator
- SQL Server: convert ((int)year,(int)month,(int)day) to Datetime [duplicate]
- How to wait for 2 seconds?
- Can I have a foreign key referencing a column in a view in SQL Server?
- How do you add a NOT NULL Column to a large table in SQL Server?
- 7645 Null or empty full-text predicate
- SQL Server backup/restore vs. detach/attach
- How does SQL Server decide format for implicit datetime conversion?
- Error converting data types when importing from Excel to SQL Server 2008
- EAV over SQL Server
- The Best Way to shred XML data into SQL Server database columns