Hi Guys,
Kind of stuck on a query here.
select *--, c.last_name + ', ' + c.first_name as name
from dbo.tblLevelOneApprover a
inner join dbo.tblLevelTwoApproverToLevelOneApprover b
on convert(int, b.level_two_emplid) != convert(int, @emplid)
where convert(int, a.emplid) = convert(int, b.level_one_emplid)
I'm trying to get all level one managers who are not mapped to a particular level 2 manager. For example, let's call this table dbo.tblLevelTwoApproverToLevelOneApprover with following entries:
level_two_emplid | level_one_emplid
stan | susan
al | freddy
max | susan
karen | jeff
bob | freddy
So what I'm trying to do is, when I try to run the above query with stan's id, I should get back only jeff and freddy (people who are not mapped to him). Another example is if we run bob, we should get back jeff and susan.
In the above query, I have the line on convert(int, b.level_two_emplid) != convert(int, @emplid)
which minuses susan once, but since she's repeated with another level 2 manager, her name still shows up. So how do I say don't return me the names of the people that you map to.
Am I missing something ridiculously simple here?