I have 2 tables emp and salgrade whose schema is defined as : emp(empno,ename,sal,mgr) and salgrade(grade,losal,hisal)
Query is
List the most senior empl working under the king and grade is more than 3.
I have written it as stated below by first extracting all the employees working under KING with grade >3 and then from it extracting the senior most employee along with its hiredate but it is giving me syntax error ,not a single-group-group function ,please guide where am I doing wrong ?
SELECT ename,
Min(hiredate)
FROM (SELECT ename,
hiredate
FROM emp,
salgrade
WHERE mgr = (SELECT empno
FROM emp
WHERE ename = 'KING')
AND salgrade.grade > 3
AND emp.sal BETWEEN salgrade.losal AND salgrade.hisal);