K
Keven Denen
Trying to figure this query out.
I have two tables; Company and Contact. 1 Company can have many
contacts, but only 1 primary contact marked by a yes/no field (Pri?)
in the contact table. The primary contact is the decision maker, so a
company could have contacts, without having one of them set as
primary.
The query I have so far.
SELECT Company.Name, Contact.Name, Contact.[Pri?]
FROM Company LEFT JOIN Contact ON Company.AcctID = Contact.AcctID
WHERE Contact.[Pri?] Is Null OR Contact.[Pri?]=True;
This gives me all Companies that have a primary contact set and all
companies that don't have any contact at all. What I don't get is
companies that have contacts but no decision maker.
What I want is a record for every company, including the decision
maker if there is one, but a blank field for contact if there is no
primary contact.
Is this possible with a single query? Am I even making sense? I've
been thinking about this for too long and can't tell if I'm making
sense anymore...
I have two tables; Company and Contact. 1 Company can have many
contacts, but only 1 primary contact marked by a yes/no field (Pri?)
in the contact table. The primary contact is the decision maker, so a
company could have contacts, without having one of them set as
primary.
The query I have so far.
SELECT Company.Name, Contact.Name, Contact.[Pri?]
FROM Company LEFT JOIN Contact ON Company.AcctID = Contact.AcctID
WHERE Contact.[Pri?] Is Null OR Contact.[Pri?]=True;
This gives me all Companies that have a primary contact set and all
companies that don't have any contact at all. What I don't get is
companies that have contacts but no decision maker.
What I want is a record for every company, including the decision
maker if there is one, but a blank field for contact if there is no
primary contact.
Is this possible with a single query? Am I even making sense? I've
been thinking about this for too long and can't tell if I'm making
sense anymore...