tags:

views:

91

answers:

3

How to find 2nd and 3rd largest amount from a table

+7  A: 
SELECT ... FROM ... ORDER BY column DESC LIMIT 2 OFFSET 1;

Depending on your SQL dialect there's a different way of specifying LIMIT and OFFSET.

ThiefMaster
A: 

SQL Server 2000+

SELECT TOP 2
   *
FROM
   (
   SELECT TOP 3 * FROM table ORDER BY Something DESC
   ) T
ORDER BY Something
gbn
A: 

If you are using SQL Server 2005+ you can use the ROW_NUMBER construct.

Brian Gideon