>> SELECT u.uname FROM users u
>>   WHERE NOT EXISTS (SELECT * FROM team_members=20
>>                       WHERE team_id =3D 7 AND user_id=3Du.user_id);

>It sounds to me like you are trying to ask the database:

>  "Tell me all the users that aren't in team 7."

Yes.

> If so, this should work:
>
>  SELECT u.uname
>    FROM users u
>    LEFT JOIN team_members t ON u.user_id =3D t.user_id
>     AND t.team_id =3D 7
>   WHERE t.team_id is NULL

Perfect :-) thanks very much this query works perfectly, you are a star.

Thanks to all the helpful suggestions :-)

Vic
--
This message, including attachments, is intended only for the use by the
person(s) to whom it is addressed. It may contain information which is
privileged and confidential. Copying or use by anybody else is not
authorised. If you are not the intended recipient, please contact the sender
as soon as possible. The views expressed in this communication may not
necessarily be the views held by Serco Integrated Transport.

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