From: Victor Kirk <[EMAIL PROTECTED]> > 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." 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 --- Rodney Broom President, R.Broom Consulting http://www.rbroom.com/ sql --------------------------------------------------------------------- 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