?
Solved

Only include rows that do not exist in 2nd query

Posted on 2013-06-18
2
Medium Priority
?
286 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
[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 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 2000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
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 …
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.
Suggested Courses

770 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