How to assign contact to account if it is not a member

pinstripe

Registered User.
Local time
Today, 14:44
Joined
Dec 13, 2007
Messages
12
To clarify:
i have table with companies (accounts) and a table contacts (people working for the specific company.
Then among this contacts there are contacts - individuals not linked to any account.
Question:
how to relate tables contacts with acounts if some are linked and some not ?
thanks in advance
 
It depends on how many companies a contact can work for. If its only one, then you put the Company ID field from the Companies table in the Contacts table in the record of the contact. If its more than one or you want to keep a history of who has worked for what company, you would create a 3rd table which lists the Company ID, the Contact ID and possibly start and end dates.
 
no in fact it is like this:
account - company ABC
contact - John Smith - woks for ABC
contact - Anne McCinly - individual - does not work for any company

so contact John is easy to link with account ABC but Anne i don't know how to link to account if both are in same contact table?
the question:
how to link accounts with contacts if not all contacts are linked to accounts?
 
My instructions weren't yes/no, they were conditional. So, based on what is occuring in your database you should use this mehtod:


If its only one, then you put the Company ID field from the Companies table in the Contacts table in the record of the contact.

Accounts
AccountID, CompanyName
1, ABC
2, Acme
3, Smith & Sons

Contacts
ContactID, CompanyID, FirstName, LastName
1, 1, John, Smith
1, , Anne, McCinly

For the answer to your unasked follow-up question, google 'LEFT JOIN Query'
 
@plog

thx for your reply ... will go with your lead :)
i hope this will do the trick
 

Users who are viewing this thread

Back
Top Bottom