Products

Solutions

Resources

Partners

Community

About

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...SQL Query to Display Users and their Profile by RoleSQL Query to Display Users and their Profile by Role
Previous
 
Next
New Post
3/25/2011 10:47 AM
 
I appologize if this is not the right forum to ask this question.

 

I am trying to generate a SQL query that will display a listing of users and their profile (along with user defined profile fields) by role so that I can add this view as a report using the Reports module (or any 3rd party module that accepts SQL Query).



Any help is greatly appreciated.



Thanks.

 
New Post
3/25/2011 12:08 PM
 
Ahmed

It can be small problem to show all profiles fields. Because:

1) It is not the same table as users. Users is in the "users" table, properties of each user in the UserProfile table.
2) Second problem is: UserProfileTable relates to the Users table as many to one. So profile properties for each user are not in single row, but in many rows. For better understanding just run a query

SELECT * FROM UserProfileTable; 

To show just FirstName, lastName, Email, UserID and other important fields you can use view vw_Users. So it will be like: 

SELECT * FROM vw_Users;

Sergey
 
New Post
3/25/2011 1:30 PM
 

SELECT UserProfile.UserID,ProfilePropertyDefinition.PropertyName,

UserProfile.PropertyValue,

Users.Username,Users.FirstName,Users.Email

FROM UserProfile

INNER JOIN ProfilePropertyDefinition

ON UserProfile.PropertyDefinitionID = ProfilePropertyDefinition.PropertyDefinitionID

INNER JOIN Users

ON UserProfile.UserID = Users.UserID

 
New Post
3/25/2011 2:03 PM
 
I see. So there is no way to display a report based on users' profile?
 
New Post
3/25/2011 2:10 PM
 
Ahmed

No, its possible, but you should know at least what properties from the profile do you like to show.

Sergey
 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...SQL Query to Display Users and their Profile by RoleSQL Query to Display Users and their Profile by Role


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out