+ 2

how to find second the second maximum in a column using a subquery

subquery

24th Oct 2016, 9:00 PM
Sandeep Singh Negi
Sandeep Singh Negi - avatar
4 Antworten
+ 2
select Max(columna) as secondmax from table where columna not in ( select Max(columna) from table);
24th Oct 2016, 10:59 PM
Jose Baca
Jose Baca - avatar
+ 2
jose's answer is correct, you can also try, SELECT column FROM table WHERE column < MAX(column) ORDER BY column DESC LIMIT 1;
26th Oct 2016, 4:05 PM
santosh ojha
santosh ojha - avatar
+ 1
SELECT column FROM table WHERE column < MAX(column) ORDER BY column DESC LIMIT 1;
2nd Nov 2016, 4:34 AM
DHRUV RANA
DHRUV RANA - avatar
- 5
YouStupidFuckingBitch
2nd Nov 2016, 8:51 AM
Hasan Zakaria
Hasan Zakaria - avatar