Joining two tables with null values in the joined fields

iamcaesar

New Member
Joined
Jun 17, 2004
Messages
8
Hi,

I have two tables:

Table 1
field1 field 2
AAA BBB
CCC NULL

Table 2
field3 field 4
AAA BBB
CCC NULL


Where null is the null value, not the word null.

If I link these tables so that field1<->field3 and field2<->field4, and then write a query to get field1 and field2, the results are:

field1 field 2
AAA BBB

Basically, its not pulling any field where there is a null value as part of the link. Any idea how to fix this? I want the end results of this query to look like:

field1 field 2
AAA BBB
CCC NULL


I hope this isn't too confusing. Thanks in advance for any insights,

Caesar :huh: :huh:
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I've just created Table1 and Table2 as per your example in Access.

I then ran this query.

SELECT Table1.field1, Table1.field2
FROM Table1 LEFT JOIN Table2 ON (Table1.field2 = Table2.field4) AND (Table1.field1 = Table2.field3);


It returned what you want.

The link between the tables should be One to Many, Table1 to Table2
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,122
Members
452,381
Latest member
Nova88

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