Solved

Only include rows that do not exist in 2nd query

Posted on 2013-06-18
2
246 Views
Last Modified: 2013-06-18
I am using Microsoft Access with ODBC tables

I have 2 queries that query the same tables but with different criteria.
I'd like the 1st query to only include records that do not exist in my 2nd query.
How do I achieve this?

Both queries include Names and a reference number.
Query 1 should only include all rows where the reference number does not exist in any rows in the 2nd query.
0
Comment
Question by:antonioking
2 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39256997
try this query

select *
from query1 as q1 left join query2 as q2
on q1.[reference number]=q2.[reference number]
where q2.[reference number] is null
0
 

Author Closing Comment

by:antonioking
ID: 39258011
Thank you!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
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…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

759 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

20 Experts available now in Live!

Get 1:1 Help Now