Limiting Query to Columns that do not match

GMC111568

New Member
Joined
Oct 3, 2016
Messages
11
In my Access database, I have two tables, from different sources, that have similar data. Each table has a customer number, and a customer name.

I'm trying to create a query that will show only names that don't match for a given customer number.

So, in Table_1, I have

3704 Fred Flintstone
3705 Barney Rubble
3706 Wilma Flintstone

In Table_2, I have

3704 Fred Flintstone
3705 George Jetson
3706 Wilma Flintstone

I've made a query that joins on customer number, and shows the name fields from both, so it looks like this:

3704 Fred Flintstone Fred Flintstone
3705 Barney Rubble George Jetson
3706 Wilma Flintstone Wilma Flintstone

But, what I want, is for it to only show the row that doesn't match:

3705 Barney Rubble George Jetson

Any suggestions on how to accomplish this? I'm using Access 2010
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
didn't try it, but maybe something like this

Code:
select 
  Table_1.ID, 
  Table_1.customer_name,
  Table_2.customer_name,
from 
  Table_1 
    inner join 
      Table_2 
    on
    Table_1.ID = Table_2.ID
where 
(
  Table_1.ID in
  (
    select 
      Table_1.ID 
    from 
      Table_1 
        inner join 
          Table_2 
        on
        Table_1.ID = Table_2.ID
        and  
        Table_1.name <> Table_2.name
  )
)
 
Upvote 0
You might need to think about what records are in one but not the other, if this is a possibility.

Table1:
3707 Scooby Doo
3709 Velma

Table2:
3708 Fred
3710 Daphne
 
Upvote 0

Forum statistics

Threads
1,215,256
Messages
6,123,911
Members
449,132
Latest member
Rosie14

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