You are looking for a list of people rather than a list of events and the people attending them. So you want to start your select from People, not from Events. Get a list of all the people, then filter out those attending event id 2. You don't want to start you select from epeople because then you are excluding those people that are not attending any event.

select people.id as pid,concat(lastname,", ",firstname) as name
from people
left join epeople on epeople.pid=people.id
left join events on events.id=epeople.eid
where events.id!=2

I think will do it, although something "feels" wrong. Hmmm, let me know.


On Tuesday, January 21, 2003, at 11:43 AM, Josh L Bernardini wrote:

The following query returns a list of all the people participating in a
particular event
given an event id.

select people.id as pid, concat(lastname, ", ", firstname) as name from
events
      left join epeople on events.id=epeople.eid
      left join people on epeople.pid=people.id
            where events.id=2;

How could I get a list of all the people not participating?
      thought I would add to the where clause with:
            and people.id is null;

--
Brent Baisley
Systems Architect
Landover Associates, Inc.
Search & Advisory Services for Advanced Technology Environments
p: 212.759.6400/800.759.0577


---------------------------------------------------------------------
Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to