Created
September 1, 2010 22:15
-
-
Save zeroeth/561471 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- supplied with two group ids, return all users with ONLY those two groups. | |
SELECT users.*, count(*) as grp_count | |
FROM users | |
JOIN users_groups | |
ON users.id = users_groups.user_id | |
WHERE users_groups.group_id in (730, 733) | |
GROUP BY users.id | |
HAVING count(*) = 2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment