Solved

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

Posted on 2013-11-27
3
386 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

623 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