How to find the row with 7th highest salary from employee table in MySQL? I have tried it this way but unable to get the exact query.
SELECT MAX(salary) FROM employee
WHERE salary NOT IN
(SELECT MAX(salary) FROM employee)
How to find the row with 7th highest salary from employee table in MySQL? I have tried it this way but unable to get the exact query.
SELECT MAX(salary) FROM employee
WHERE salary NOT IN
(SELECT MAX(salary) FROM employee)
What a brief post!!! Try this though,
select *
from(
select distinct salary
from employee
order by salary desc limit 7
) t
order by salary
limit 1
maybe you can use this
SELECT * FROM employe ORDER BY salary DESC LIMIT 7
hope this will help you
I got the answer.
SELECT *
FROM one one1
WHERE ( 7 ) = ( SELECT COUNT( one2.salary )
FROM one one2
WHERE one2.salary >= one1.salary
)
SELECT *
FROM employees emp
WHERE 7 =
(SELECT COUNT(DISTINCT salary)
FROM employees
WHERE emp.salary<=salary );