Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table linking problem - data not showing on report

Status
Not open for further replies.

trendzone

MIS
Aug 9, 2003
3
0
0
US
Here is my situation:
I have table called 'contact' and it has a field named 'companyid'.

I link this field to the 'companyid' field in a second table called 'destination'. 'Destination' has a field named 'destinationid'.

'Destinationid' is then linked to 'destinationid' in a third table called 'customerdestination'. It has a field named 'customerid'.

'Customerid' is then linked to 'customerid' in a fourth table called 'customer'.

So my logic is for every 'companyid' value there is a corresponding 'destinationid' value and for every 'destinationid' value there is a corresponding 'customerdestinationid' value and for every 'customerdestinationid' value there is a 'customerid' value.

My ultimate goal is to show the 'customerid' that matches the 'companyid' value, but I can only show the 'destinationid' from the second table. Why can't i show the values from the 3rd or 4th table?

I hope all this makes sense. Thanks in advance for any help.

-Scott
 
You probably have some nulls, but I also think you might be approaching this backwards. For linking, you should start with the table that you are sure is populated, and the customer table seems like a good candidate, especially since this is the data you really want to focus on.

You might try reversing the links. If you think some customers might not have a corresponding company ID but you want to include them anyway, then use a left join from the customer table to the next table, and continue using left joins.

-LB
 
Thanks for the reply. As it turned out, there had been a change in the database that my programmer didn't alert me about and I was using the wrong table. :-}

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top