how we can find nth max salary from an employe table by
using my sql?
Answers were Sorted based on User's Feedback
Answer / pious deepak
select salary from employee
order by salary desc limit n-1, 1
| Is This Answer Correct ? | 29 Yes | 4 No |
Answer / whatinaname
select max(salary) from employee
order by salary desc limit n-1, 1
| Is This Answer Correct ? | 14 Yes | 2 No |
Answer / ksam
select distinct(salary) from employee order by salary desc
limit n-1,1
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / nivedita
select max(salary) from employee order by salary desc limit 1;
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / jithu
Another way is::
SELECT sal FROM sal a WHERE n = ( SELECT count(*) FROM sal
b WHERE b.sal < a.sal)
| Is This Answer Correct ? | 4 Yes | 2 No |
Answer / sumit
select salary from employee e1
where (n-1)=(select count(*) from employee where
salary>e1.salary)
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sandeep
select MAXIMUM(salary) from (select salary from employee
order by salary desc limit 'n')
n means number of rows
| Is This Answer Correct ? | 10 Yes | 18 No |
What is “i_am_a_dump” flag in mysql?
How do I stop a mysql command?
What are the other commands to know the structure of table using MySQL commands except explain command?
What is general log in mysql?
I want to start and stop mysql on windows? How do I do that?
Is mysql a good database?
What is the use of mysql_close()?
What is the latest version of php and mysql?
What are the nonstandard string types?
How to connect html form to mysql database using php?
Where is mysql password stored?
Differentiate CHAR_LENGTH and LENGTH?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)