Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6764865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T14:38:40+00:00 2026-05-26T14:38:40+00:00

I am trying to query DNN and get two PropertyDefinitionID’s and two the values

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T14:38:41+00:00Added an answer on May 26, 2026 at 2:38 pm

    Use

    WHERE (p.PropertyValue = 'b510dab0-8bf6-e011-84a9-00505691002c' AND
           p.PropertyDefinitionID = '47') OR /*<------------------- Changed*/
          (p.PropertyValue = 'True' AND
           p.PropertyDefinitionID = '48')
    

    In response to the comments. To get users meeting both criteria you can use.

    SELECT u.*
    FROM   vw_Users u
           INNER JOIN UserRoles r
             ON u.UserID = r.UserID
    WHERE  r.RoleID = '4'
           AND u.UserId IN (SELECT UserID
                            FROM   UserProfile
                            WHERE  ( PropertyValue =
                                     'b510dab0-8bf6-e011-84a9-00505691002c'
                                     AND PropertyDefinitionID = '47' )
                                    OR 
                                   ( PropertyValue = 'True'
                                     AND PropertyDefinitionID = '48' )
                            GROUP  BY UserID
                            HAVING COUNT(DISTINCT PropertyDefinitionID) = 2)  
    

    It should be clear how to extend this for an arbitrary number of conditions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to query tables using join but I can't get success here
trying to query mssql database using JSP. connected the database using ODBC but this
I'm trying to query a MySQL database using an array but I'm having trouble!
i am trying this query but didn't work. ERROR: #1064 - You have an
I am trying this query, but didn't work INSERT INTO single_user (location_home.id_location_home ) SELECT
Im trying to query a List but unable to get the result the way
Trying to query a 'Favorites' model to get a list of items a user
I am trying to query the windows desktop search API using SQL. I have
I am trying to query an .xls spreadsheet with VBScript, but I have run
I'm trying to query using Castle and return a strong-typed array or IList for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.