consider a table which contain 4 columns,ename,eno,sal and
deptno, from this table i want to know ename who having
maximum salary in deptno 10 and 20.

Answer Posted / vishnu prasad.ma

SELECT A.EMP_NAME, SUM(B.MAX_SALARY) AS MAX_SAL, B.EMP_DEPT_NO FROM EMP_DETAILS A,
(SELECT MAX(EMP_SAL) AS MAX_SALARY, EMP_DEPT_NO FROM EMP_DETAILS WHERE EMP_DEPT_NO IN (10,20)
GROUP BY EMP_DEPT_NO) B
WHERE
A.EMP_SAL = B.MAX_SALARY
AND A.EMP_DEPT_NO = B.EMP_DEPT_NO
GROUP BY A.EMP_NAME, B.EMP_DEPT_NO

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

discuss about myisam key cache. : Sql dba

565


How do I quit sql?

503


What is the difference between left outer join and left join?

519


Explain what is a view?

600


Does truncate require commit?

547






Does view contain data?

622


What is snowflake sql?

582


What are inner outer left and right joins in sql?

519


What are local and global variables and their differences?

592


How much does a sql dba make? : SQL DBA

512


what is the difference between cluster and non cluster index? : Sql dba

559


What is the difference between distinct and unique in sql?

476


What is vector point function?

573


What is data profiling in sql?

521


What are the main features of cursor?

631