Re: Query Me This -- two references to another tables field
- From: Steve Schapel <schapel@xxxxxxxxxxx>
- Date: Sun, 26 Jun 2005 06:55:04 +1200
Carol,
Add the tblContacts table twice to your query. One copy will be joined to the RContactID and the other to the ReferredByContactID.
Having said that, it seems to me that your design here is more complicated than it needs to be. Each contact can only be referred by one other contact, right? So why not just put a ReferredBy field in the tblContacts table, and remove the tbleReferrals table altogether?
-- Steve Schapel, Microsoft Access MVP
CS wrote:
I have: tblContacts -- primary key is ContactID, autonumber -- general contact info tblReferrals -- primary key is RContactID, number, no duplicates -- table contains info about who referred who.
In tblReferrals, the ContactID from tblContacts is referenced twice -- once as the Primary Key RContactID which says who is being referred, again under ReferredByContactID (foreign key number field) which says who referred them.
I want to query these tables to print a cross-reference report of who referred who, and show the concatenated full names of both the person being referred and the person referring them.
My problem: If I join the tables in the query by tbleContacts.ContactID<>tblReferrals.RContactID, I can concatenate the name of the person being referred, but not the name of the person referring them. If I join by ContactID<>ReferredByContactID, same problem in reverse -- name of referrer but not the person referred.
How can I query to pull from the tblContacts the full concatenated name of both the person being referred and the person who is referring them?
Thanks in advance for any help. Carol
.
- Follow-Ups:
- References:
- Prev by Date: Query Me This -- two references to another tables field
- Next by Date: Re: Query Me This -- two references to another tables field
- Previous by thread: Query Me This -- two references to another tables field
- Next by thread: Re: Query Me This -- two references to another tables field
- Index(es):
Relevant Pages
|