I have 2 tables, one containing personal info about volunteers the other containing an event id and dates for activities and id for those who have volunteered for that date. Some activities for which volunteers are needed are 2-3 day affairs.
The event list looks like this: (event id, volunteer id, date of event)
20 vol_id1 2002-06-16
20 vol_id2 2002-06-16
31 vol_id3 2002-07-13
31 vol_id2 2002-07-14
44 vol_id1 2002-08-15
44 vol_id4 2002-08-15
I need to select names that are not associated with an event id on a given date without repetition.
I tried the following:
select distinct vol.firstname, vol.lastname, vol.email, vol.volid
from vol
left join event
on vol.volid=event.volid
where event.eventid!='$eventID'
or event.eventid is NULL
and event.date!='$date'
order by vol.lastname"
but this results in repetition, I get every volunteer who has not signed up for the event in question, but I get them in the list for every other event that they've signed up for.
For example, if $eventID is 31, in other words I want those who have not volunteered for event 31, the list that results iis
vol_id1
vol_id1
vol_id4
I want to kill the repetition that results because vol_id1 has registered for more than on event.
Any help would be appreciated.
Thanks
B