I’m writing a contacts & events database and want to view those contacts that have not been invited to a specific event. I have the following tables and queries:
Contacts – Table
Events – Table
ContactInvitation – Table (creates PK of EventID & ContactID to show who has been invited to which event)
Guests&Events – Query (shows all instances of contacts and and the events they have been invited too)
In Guests&Events if a contact has not been invited to an event the event field is blank. If they have been invited to more than one event there are duplicte contacts names showing the events they are invited to. e.g.
Mark – Null
Sean – Null
Steven – Event 1
Steven – Event 2
Mike – Event 1
Jill – Event 1
Rob – Event 2
I now want to filter these contacts to show only (1 instance of each contact) that has not been invited to a specific event. E.g. show all contacts that have not been invited to Event 1.
The query for NotInvited to event 1 shouldshow Mark, Sean & Rob.
However, I am having difficulty with the fact that Steven is invited to Event 1 & 2 so if I filter on “Event<>1 OR Event=Null) Steven will still appear in the list even though he has been invited to Event 1.
Please help! This has been driving me crazy. I have spent the last couple of days googling and although I have now learned about GROUPBY and sub queries I can’t seem to work out a solution.
Many thanks in advance for your time.
I would first remove all rows from the
ContactInvitationthat have NULLs. They are useless and may cause trouble. If a Person has not been invited to an event, you simply have no row for that (invitation) in the table. No need to put rows with Nulls.Then you could use this query: