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 732253
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:07:13+00:00 2026-05-14T07:07:13+00:00

Our application allows administrators to add User Properties in order for them to be

  • 0

Our application allows administrators to add “User Properties” in order for them to be able to tailor the system to match their own HR systems. For example, if your company has departments, you can define “Departments” in the Properties table and then add values that correspond to “Departments” such as “Jewelry”, “Electronics” etc… You are then able to assign a department to users.

Here is the schema:
Schema
(source: mindgravy.net)

In this schema, a User can have only one UserPropertyValue per Property, but doesn’t have to have a value for the property.

I am trying to build a query that will be used in SSRS 2005 and also have it use the PropertyValues as the filter for users. My query looks like this:

SELECT UserLogin, FirstName, LastName
FROM Users U
LEFT OUTER JOIN UserPropertyValues UPV
    ON U.ID = UPV.UserID
WHERE UPV.PropertyValueID IN (1, 5)

When I run this, if the user has ANY of the property values, they are returned. What I would like to have is where this query will return users that have values BY PROPERTY.

So if PropertyValueID = 1 is of Department (Jewelry), and PropertyValueID = 5 is of EmploymentType (Full Time), I want to return all users that are in Department Jewelry that are EmployeeType of Full Time, can this be done?


Here’s a full data example:

  • User A has Department(Jewelry value = 1) and EmploymentType(FullTime value = 5)
  • User B has Department(Electronics value = 2) and EmploymentType(FullTime value = 5)
  • User C has Department(Jewelry value = 1) and EmployementType(PartTime value = 6)

My query should only return User A using the above query

UPDATE:

I should state that this query is used as a dataset in SSRS, so the parameter passed to the query will be @PropertyIDs and it is defined as a multi-value parameter in SSRS.

WHERE UPV.PropertyValueID IN (@PropertyIDs)

  • 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-14T07:07:13+00:00Added an answer on May 14, 2026 at 7:07 am

    I figured out how to get this working in a completely hacky fashion:

    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
    

    Because we can determine the number of properties used in the parameter @PropertyIDs (returned by the select count(*)), we can make sure that the users returned from the query has the same number of properties as what was passed in @PropertyIDs.

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

Sidebar

Related Questions

We have an application that allows the user to add custom columns to our
Our picture editing cocoa application allows the user to add a string to a
Our web application allows users to specify their own slugs which can include relative
Our application uses SQL Server Reporting Services and allows users to add custom filters
In our application, we allow user's to write their Bio using a WYSIWYG editor,
I'm about to implement a feature in our application that allows the user to
Background: We're building an application that allows our customers to supply data in a
I am making an application which allows us to send sms to our contacts
I'm creating an application for our office that allows authenticated users in the office
Our application allows users to upload javascript, CSS, and HTML files. We need a

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.