Solved

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

Posted on 2013-11-27
3
378 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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks guys. That's just what I needed. I used the first suggestion but appreciate the simplicity of the second.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
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…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
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…

762 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

7 Experts available now in Live!

Get 1:1 Help Now