>If there are people with both dates of < and > 06/01/2003
Spell out how your table has people that can have more than one date. This will affect the query that's generated.
Main Topics
Browse All TopicsI am trying to create a query that gives me all people with a date of only <06/01/03. If there are people with both dates of < and > 06/01/2003, then I don't want them to show in the query. Any help?
I am using Access
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Also, using Date as the name of a field is a MAJOR error, since Date is a RESERVED word in Access (the name of the standard system function that returns the system Date for Today), so you MUST enclose your field name in [...], like this:
select name from test as a
where [date] < #06/01/2003#
and not exists (select b.name from test as b where a.name=b.name and b.[date] > #06/01/2003#)
AW
Most Access databases won't allow you to use the single quote ' as a date delimiter. MS Access uses the # symbol to surround dates, much like in Visual Basic code.
So your query ought to be:
SELECT [Name], [Date]
FROM Test
WHERE [Date] < #6/1/2003#
Since the date field can only hold one value, you won't need to check for > #6/1/2003#. However, if you actually have two date fields, say Date1 and Date2, it would be:
SELECT [Name], [Date1]
FROM Test
WHERE [Date1] < #6/1/2003# and not ([Date2] > #6/1/2003#)
Business Accounts
Answer for Membership
by: heartburnPosted on 2005-01-19 at 14:26:09ID: 13088039
select distinct person from table
where thedate < '06/01/03'
and person not in
(
select person from table
where thedate > '06/01/03'
)