What is the simplest SQL Query to find the second largest value?

Niyaz picture Niyaz · Aug 28, 2008 · Viewed 398.7k times · Source

What is the simplest SQL query to find the second largest integer value in a specific column?

There are maybe duplicate values in the column.

Answer

Matt Rogish picture Matt Rogish · Aug 28, 2008
SELECT MAX( col )
  FROM table
 WHERE col < ( SELECT MAX( col )
                 FROM table )