Solved

What is the opposite to an "Union All" clause in MS Access?

Posted on 2011-02-15
5
861 Views
Last Modified: 2012-05-11
Hi All!

I have two queries with the same fields.  The first one returns 1000 records; the second one, 100 records whose Id's intersect with some of the first query.  What I want to do is to perform a query that shows the records of the first query MINUS the ones of the second query.  In fact, what I'm looking for here is the opposition of an Union All clause.

I tried this ("Not In" clause) before, but it didn't return any record.  Weirdly enough, an "In" clause works fine, nut not a "Not In" clause.  

SELECT [Équipement total].MODEL_NO
FROM [Équipement total]

where  [Équipement total].MODEL_NO

not IN

(SELECT [Équipement à exclure].MODEL_NO
FROM [Équipement à exclure])
order by MODEL_NO

Would anyone have a solution to this simple problem?

Thanks!

Francis
0
Comment
Question by:AlainSt-Pierre
[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
  • 2
  • 2
5 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34900613
copy and paste this to the SQL view of the query

SELECT [Équipement total].MODEL_NO
FROM [Équipement total] Left Join [Équipement à exclure]
On [Équipement total].MODEL_NO= [Équipement à exclure].MODEL_NO
Where [Équipement à exclure].MODEL_NO is null
0
 

Author Comment

by:AlainSt-Pierre
ID: 34901012
Hi capricorn,

I'm glad to read from you once again!  Unfortunately your query isn't returning any result. FYI I joined the results of my two queries.

Thank you!

Francis
My-Queries.docx
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34901113
can you upload a copy of the db.
0
 
LVL 84
ID: 34902005
Try a Right Join:

SELECT [Équipement total].MODEL_NO
FROM [Équipement total] RIGHT JOIN [Équipement à exclure]
On [Équipement total].MODEL_NO= [Équipement à exclure].MODEL_NO
Where [Équipement total].MODEL_NO is null
0
 

Author Comment

by:AlainSt-Pierre
ID: 34906477
Cap's query was just fine.  I closed the db, reopened it then it worked fine.  It seems like the damn thing's got a hard time saving new modifications.  Thanks a lot guys!!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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.
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…
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.

735 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