I am trying to query DNN and get two PropertyDefinitionID’s and two the values for each PropertyDefinitionID. This is the code I am using right now but doesn’t return any results.
SELECT *
FROM vw_Users u
INNER JOIN UserRoles r ON u.UserID = r.UserID and r.RoleID = '4'
INNER JOIN UserProfile p ON u.UserID = p.UserID
WHERE (p.PropertyValue = 'b510dab0-8bf6-e011-84a9-00505691002c' AND
p.PropertyDefinitionID = '47') AND
(p.PropertyValue = 'True' AND
p.PropertyDefinitionID = '48')
ORDER BY p.PropertyValue
There is a record with a PropertyDefinitionID = 47 and PropertyValue = ‘b510dab0-8bf6-e011-84a9-00505691002c’. And there is also a record with PropertyDefinitionID = 48 and PropertyValue = ‘True’.
So if I broke this query apart I would get this for the first one:
UserId PropertyDefinitionID PropertyValue
5 47 eb03dde0-8bf6-e011-84a9-00505691002c
and this for the second one:
UserId PropertyDefinitionID PropertyValue
5 48 True
But I would like them to be in one Query or at least the results be combined. Is this possible? And if so how in the world do you do it?
EDIT: But I only want to return the result if it has a Value for PropertyDefinitionID = 47 and only if PropertyDefinitionID = 48 is true. I want both criteria to meet.
Thanks!
Use
In response to the comments. To get users meeting both criteria you can use.
It should be clear how to extend this for an arbitrary number of conditions.