I’m trying to put together a Self Join using a Group By clause to see which person is getting paid the highest in their respective jobs but I keep getting this error
00904. 00000 - "%s: invalid identifier"
Below is my code that I am currently trying to fix:
Select a.*,b.sal
From EMP a,(Select job,MAX(sal)
From EMP
Group By job) b
Where a.empno = b.empno
I did some research and I couldn’t find anything that pertained to what I am doing (maybe becayse what I am doing is too simple?) but nonetheless I am looking for anything that will point me in the right direction. Thanks in advance.
You don’t have a column called
empnothat you are returning in the subquery. I think you want something like this which will return themax(sal)for each employee based on the job: