multiple table relationships

tasander

Board Regular
Joined
Mar 6, 2009
Messages
67
Hi

I have 2 tables as per below, table 1 has the exact people i require in it but table 2 has an extra bit of detail i need to pull in. Currently i have created 2 relationship from table 1 to table 2 (firstName - ChristianName) and (Surname - SecondName). these are on a include all records from table 1 and equal records from table 2 join type.

Table1
FirstName Surname

Table2
ChristianName SecondName PhoneNumber


When i run a query to pull back the data i am getting more records than are in table 1, after some investigation it was duplictaing rows in table 1 where it found a match in table 2 but there was a null PhoneNumber.

Can anyone help me with this?
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
If you end up with more records in your query than exists in table 1, that means you have a one-to-many relationship between the two tables instead of a one-to-one match. So, for some of your records in table 1, there are multiple records in table 2 that match it.

So, you need to determine what you want to do in those cases. If a record in table 1 matches two records in table 2, which matching record do you want to return?
Once you figure out the logic you want to use, you can try to incorporate that into the Criteria of your query.
 
Upvote 0

Forum statistics

Threads
1,217,388
Messages
6,136,298
Members
450,002
Latest member
bybynhoc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top