I have to be missing something simple here, but I am having trouble formatting
an MySQL query to select users that are not part of a group. I have a users
table, a groups table, and then a users-to-groups table.
This query…
SELECT user.user_id
FROM users_groups usgr
INNER JOIN users user
ON usgr.usgr_user_id=user.user_id
WHERE usgr.usgr_grou_id=1
AND user.user_status=1
…gives me all the users in group 1.
It then seems that this…
SELECT user.user_id
FROM users user
LEFT JOIN users_groups usgr
ON usgr.usgr_user_id=user.user_id
WHERE usgr.usgr_grou_id!=1
AND user.user_status=1
…should give me all users not in that group, but it doesn't work. What am I
missing?
_______________________________________________
UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net