On Tue, 2003-01-21 at 15:51, Josh L Bernardini wrote:
> 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.
In this query you're querying events with no attendants (people.id IS
NULL) and with event Id 2. Did event 2 have at least an attendant? If
so, then the result must be empty.
I guess you will need a TEMP table.
HTH
--
__
/ \\ @ __ __ @ Adolfo Bello <[EMAIL PROTECTED]>
/ // // /\ / \\ // \ // Bello Ingenieria S.A, ICQ: 65910258
/ \\ // / \\ / // // / // cel: +58 416 609-6213
/___// // / <_/ \__\\ //__/ // fax: +58 212 952-6797
www.bisapi.com // pager: www.tun-tun.com (609-6213)
---------------------------------------------------------------------
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