I’m designing a database in Access 2010.
I have this query that works as I want it to:
SELECT Participants.ParticipantID, [FirstName]+' '+[LastName] AS Participant
FROM Participants
WHERE (((Participants.SiteName)=forms!DailyWorkshops!SiteName) And
((Participants.YearLookup)=forms!DailyWorkshops!YearLookup))
ORDER BY Participants.FirstName, Participants.LastName;
Now I want another query that gives me everything else.
ie
SELECT Participants.ParticipantID, [FirstName]+' '+[LastName] AS Participant
FROM Participants
WHERE
**exclude all these results
(((Participants.SiteName)=forms!DailyWorkshops!SiteName) And
((Participants.YearLookup)=forms!DailyWorkshops!YearLookup))**
ORDER BY Participants.FirstName, Participants.LastName;
This seems to work but I was wondering, is this the most straightforward way to do this?
SELECT Participants.ParticipantID, [FirstName]+' '+[LastName] AS Participant
FROM Participants
WHERE Participants.ParticipantID NOT IN
(SELECT Participants.ParticipantID FROM Participants WHERE
(((Participants.SiteName)=forms!DailyWorkshops!SiteName) And
((Participants.YearLookup)=forms!DailyWorkshops!YearLookup)))
ORDER BY Participants.FirstName, Participants.LastName;
Why is this not very simple…
The only reason may be because of nulls in your columns, which you can fix with: