how to find the second highest salary from emp table?

Answer Posted / rajesh

In MS SQL I was able to run the query:
select min(sal) from emp where sal in ( select top 2 sal
from emp order by desc)

but i was not able to run similar query in MySQL 5.1.41


select min(e_sal) from employee where e_sal in (select e_sal
from employee order by e_sal desc limit 2);

MySQL gives the following error:

ERROR 1235 (42000): This version of MySQL doesn't yet
support 'LIMIT & IN/ALL/ANY/SOME subquery'

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

discuss about myisam index statistics collection. : Sql dba

521


How much does a sql dba make? : SQL DBA

501


Explain the uses of control file.

608


What is a constraint? Tell me about its various levels.

633


Is not equal in sql?

560






What is query execution plan in sql?

558


what is user defined functions? : Sql dba

543


What is a file delimiter?

550


explain advantages of myisam over innodb? : Sql dba

595


What are different clauses used in sql?

579


How to avoid duplicate records in a query?

575


What is posting?

597


What are the uses of sysdate and user keywords?

619


what are the other commands to know the structure of table using mysql commands except explain command? : Sql dba

547


Why do we use subquery?

481