Question about MS Query WHERE Clause

shdawson

Active Member
Joined
Jan 6, 2007
Messages
381
Hi,


Have 2 worksheets in XLS. They have the same column, ID number. One worksheet has 8 ID numbers...the other has 10. Working on a query to trap the 2 ID numbers that are not in the first worksheet.

What would that syntax be, please?

ID Number list 1 <> ID Number list 2

???

Thanks,
S
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
let's say you had 2 tables listing the states in the united states

table State1 has more states in it than table State2 does

you want to find out which states are in State1, but not in State2

a left join is required with a test for null on the "lesser" table

Code:
SELECT 
  State1.ID, 
  State1.FullName, 
  State1.Population, 
  State2.ID
FROM 
  State1 
    LEFT JOIN 
      State2 
        ON State1.ID = State2.ID
WHERE 
(
  (
    State2.ID Is Null
  )
);
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,756
Members
452,940
Latest member
rootytrip

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