Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

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

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...SQL Help!SQL Help!
Previous
 
Next
New Post
8/28/2008 3:10 PM
 

Ok, this is more of a SQL question than a DNN question but it is dealing with the DNN tables.  Here is what I am trying to do:  I want to list a profile attribute of multiple users who are assigned to a specific role.  I have no problem selecting the attribute when there is only one user in that role, but obviously that won't do because there will be multiple users.

Here is my proposed SQL:

SELECT * FROM UserProfile WHERE (UserID = (SELECT UserID FROM UserRoles WHERE (RoleID = (SELECT TOP (1) RoleID FROM Roles WHERE (RoleName = 'CommunityMembers'))))) AND (PropertyDefinitionID = '39')

This should get me a list of the Profile Attribute that has the PropertyDefinitionID of 39 and are in the CommunityMembers Role.  In my case this is the company name, so this should list the company names of all users in the CommunityMembers role.  However, this obviously will not work since it is not valid SQL because the subquery returns more than 1 UserID since there are more than 1 users in the CommunityMembers role.  So I guess my question is how can I select multiple values from the table based on multiple ID's that will change everytime a new user is added?


And maybe I am going about this all wrong?  Any input would be greatly appreciated as I am a newb to SQL and DNN.

 
New Post
8/28/2008 3:53 PM
 

You want to use an "IN" clause like so:

select * from userprofile where userid in (select userid from userroles inner join roles on userroles.roleid = roles.roleid where rolename='CommunityMembers') and propertydefinitionid = 39

Hope that helps!


-- Jon Seeley
DotNetNuke Modules
Custom DotNetNuke and .NET Development
http://www.seeleyware.com
 
New Post
8/28/2008 6:07 PM
 

Wow, awesome.  Thanks much!  Told ya I was a newb! :D

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...SQL Help!SQL Help!


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