Hi! I am trying to find some results NOT in a resultset
The query I am using to get the resultset:
CONVERT(varchar, A.agent_id) + ' ' + A.fname + ' ' + A.lname AS name,
FROM Univlicval_billing_digits AS BD INNER JOIN
Univlicval_agents AS A ON BD.a_id = A.id
(BD.b_id = 3) AND (BD.province = 'AB')
This gives me 5 results.
I want to get the rest of the agents that are not already assigned to the b_id AND province.
I run this query:
SELECT DISTINCT id, agent_id, fname, lname, inactive
FROM Univlicval_agents AS A
WHERE (NOT EXISTS
FROM Univlicval_billing_digits AS BD
WHERE (A.id = a_id) AND (b_id = 3) AND (province = 'AB')))
And get a complete resultset from agents (24 rows) where I should have 18 rows.
I know I'm missing something simple, but I can't figure out what it is. Thanks in advance!
Thanks in advance!