Solved

MS Access Sql -  Using Join to list items that don't match

Posted on 2013-11-27
3
383 Views
Last Modified: 2013-11-28
If I have 2 tables:

CREATE TABLE Items20123( Id VarChar(15), UserName VarChar(50))
CREATE TABLE Items2011( Id VarChar(15), UserName VarChar(50))

How do I use the join command to list all of the Id's from the Items2012 table that don't exist in the Items2011 table?

I tried

Select * from Items2012 Inner Join Items2011 on Items2012.item <> Items2011.item

But got an out of memory exception.

There are about 35,000 in each table.
0
Comment
Question by:ou81aswell
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 250 total points
ID: 39682672
use a Left Join

Select * from
Items2012 LEFT Join Items2011 on Items2012.[ID] = Items2011.[ID]
where  Items2011.[ID] is null
0
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 250 total points
ID: 39682771
for the requirement  list all of the Id's from the Items2012 table that don't exist in the Items2011
try this

select * from Items2012
where Id not in ( select Id from Items2011)
0
 

Author Closing Comment

by:ou81aswell
ID: 39683332
Thanks guys. That's just what I needed. I used the first suggestion but appreciate the simplicity of the second.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question