Two tables, groups and user_permissions.

Groups is indexed by groupid as primary key. User_permissions is indexed
by username and groupid.

For each user that's in a group, a row in user_permissions exists.

 

I want to select from groups and user_permissions looking for a certain
user in user_permissions. If there is no such user in that group, I want
it to return null.

 

The reason left join doesn't work is because as long as there is at
least one user in the group, it won't return null for username. 

 

Here's the query that doesn't work:

SELECT * FROM groups LEFT JOIN user_permissions USING (groupid) WHERE
groups.groupid=5 AND user_permissions.username LIKE 'username';

 

Thanks for any and all help!

Reply via email to