MySQL Forums
Forum List  »  Newbie

Check for presence/absense of a row
Posted by: Lewis Johnston
Date: August 24, 2004 06:35PM

Hi all,

In a multi-table query, how do I test for the presence or absense of a row in a secondary table without restricting the result to just matches?

For example,

I have a table called "users" and a table called "groups". These tables are joined using users.id=groups.userid. The group someone belongs to is in groups.name. Not all users have a row in the "groups" table since not all users belong to a group. Some users are in the groups table more than once since they belong to more than one group.

If I want to get a list of users that don't belong to the group called "Losers", what query do I use?

Thanks in advance,

Lewis

Options: ReplyQuote


Subject
Written By
Posted
Check for presence/absense of a row
August 24, 2004 06:35PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.