Using Join
:
Select
j1.jobnum,
j1.empnum
From jobs j1
Join jobs j2
On j1.empnum = j2.empnum
Where j2.jobnum = 125
The query says "Give me all the records from jobs
(j1
) that have the same empnum as any record in jobs
(j2
) which has a jobnum of 125. That's the self-join that you're looking for.