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.
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.
Simplest of all
Old question I know, but this gave me a better exec plan:
It is the most esiest way:
As you mentioned duplicate values . In such case you may use DISTINCT and GROUP BY to find out second highest value
Here is a table
:
First portion of LIMIT = starting index
Second portion of LIMIT = how many value
Query to find the 2nd highest number in a row-
By changing the highlighted
Top 1
toTOP 2
,3
or4
u can find the 3rd, 4th and 5th highest respectively.