Try this solution:
SELECT DISTINCT(Salary) FROM table ORDER BY Salary DESC LIMIT n,1Query for second maximum salary from employee table:
Try this solution:
select max(salary) from emp where salary < (select max(salary) from emp)
Another solution:
Simple Answer:
SELECT sal from emp ORDER BY sal DESC LIMIT 1, 1;
You will get only the second max salary.
And if you need any 3rd or 4th or Nth value you can increase the first value followed by LIMIT (n-1) ie. for 4th salary : LIMIT 3, 1;
0 comments:
Post a Comment