WHERE team_member.user_id IS NULL
William R. Mussatto wrote:
Hi,
I got a difficult problem with a SELECT query:
In my application there are two tables, one for all users (user_profile)
one for a user-in-team relation.
I want to know, which user is still not in a speciffic team. Users can
be in more than one team, but we don't care about that.
What you want is a left join with a =null condition.. BTW recommend unique
column names, it makes this shorter since you wouldn't need the table
names..
SELECT user_profile.user_id FROM user_profile
LEFT JOIN team_member ON user_profile.user_id = team_member.user_id
WHERE team_member.user_id = null
---------------------------------------------------------------------
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