this is my solution:
Code:
select S1.JobCode
from SODts S1
left join SODts S2 on S2.JobCode = @JobCode
and S2.Quality = S1.Quality
and S1.JobCode <> @JobCode
group by S1.JobCode
having sum(case when S2.JobCode is null then 1 else 0 end) = 0
and count(S1.JobCode)
= (select count(*) from SODts S where S.JobCode = @JobCode)
defiant.