I can't come up with the join syntax to mimic this subselect query to list
people not attending an event (*epeople.eid == event.id):

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

Thought it would be:

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

but I get an empty set.

The following lists people attending an event:

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

tia,
jb

PS is 4.1 available anywhere so I could just use the subselect. Under 4.1,
are subselects or joins more efficient?



---------------------------------------------------------------------
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