Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.
2nd Highest Record from each group basis on Manager ID including Manager itself as well (Null group)
Emp_ID Emp_Name Salary Mgr_ID
1 Aman 45000 NULL
2 Deepak 35000 1
3 Pankaj 32000 1
4 Sapna 25000 1
5 Rajan 50000 NULL
6 Nupur 18000 5
7 Anamika 18000 5
8 Preet 22000 NULL
9 Shalu 27000 NULL
10 Jyoti 12000 9
11 Omesh 25000 9
12 Rakesh 21000 9
SELECT MAX(salary),E1.mgr_id FROM EMP_MGR E1,
(SELECT MAX(salary) AS sal,mgr_id FROM EMP_MGR GROUP BY mgr_id ) E2
WHERE E1.salary
Expected Result:
Mgr_ID Salary
NULL 45000
1 32000
5 18000
9 15000
This Question is not yet answered!
Related Answered Questions
Related Open Questions