View Full Version : Using results of one query as criteria for another


mjdavie
11-15-2001, 05:31 AM
I have a query that returns a number of clients (ID, Name, Address) This works fine.

What I want to do is create another query that returns every client except for the one's returned in my first query.

Can anybody help me with this

Thanks in Advance
Matthew

DJN
11-15-2001, 06:28 AM
In the criteria for the query just add Not at the start of the criteria. e.g.

Not Between #01/01/99# And #01/05/99#

Instead of Between #01/01/99# And #01/05/99#

David

mjdavie
11-15-2001, 06:38 AM
I am using the Not Statement which works fine
when my first query returns only one record, however if my first query returns more than one record then my second query seems to ignore the criteria.

Thanks for your help

araskas
11-15-2001, 03:03 PM
You can do it many ways. One of them using NOT IN

SELECT ID, Name, address
FROM [Clients]
WHERE ID Not In (
SELECT [Client].ID
FROM [Client]
WHERE conditionOfQry1 ) ;