Sunday 22 December 2013

Get data from second last row in SQL Server

We have a following table suppliersInformation and we want to Get data from second last row in SQL Server.

Following query shows how to get data from second last row in SQL Server
 
SELECT TOP 1 * FROM
  (SELECT TOP 2* FROM suppliersInformation ORDER BY sup_rec_id DESC) tbl
  ORDER BY sup_rec_id ASC


No comments:

Post a Comment