Created
April 15, 2010 19:43
-
-
Save underwhelmed/367547 to your computer and use it in GitHub Desktop.
This file contains 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
SELECT UserLogin, FirstName, LastName | |
FROM Users | |
LEFT OUTER JOIN | |
( | |
SELECT UserID | |
FROM UserPropertyValues | |
WHERE PropertyValueID IN (@PropertyIDs) | |
GROUP BY UserID | |
HAVING COUNT(UserID) = | |
( | |
SELECT COUNT(*) FROM | |
( | |
SELECT PropertyID FROM PropertyValues | |
WHERE ID IN (@PropertyIDs) GROUP BY PropertyID | |
) p | |
) | |
) filtered on Users.UserID = filtered.UserID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment