Solved

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

Posted on 2013-11-27
3
380 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 119

Accepted Solution

by:
Rey Obrero 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now