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

what are date and time functions in mysql? : Sql dba

546


What are the triggers associated with image items?

629


What are the two parts of design view?

592


what is oracle database ? : Sql dba

569


What is the file extension for sql database?

525






Does sql use python?

576


How much does sql certification cost?

558


Can we use ddl commands in pl sql?

567


What is procedure and function?

526


Why do we create views in sql?

568


What is difference between db2 and sql?

541


what are the differences between get and post methods in form submitting. Give the case where we can use get and we can use post methods? : Sql dba

680


Can we use the cursor's to create the collection in PL/SQL?

524


What does where 1/2 mean in sql?

544


how to do backup entire database? : Transact sql

626