DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

Custom query about users within a website

 4 Replies
 1 Subscribed to this topic
 24 Subscribed to this forum
Sort:
Author
Messages
Veteran Member
Posts: 363
Veteran Member
4 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
2 Avid Reader
Avid Reader
Avid Reader art thou!
2 Most Liked
Most Liked
Congrats, your posts are really liked!

Hi Community,

I've a client that is actively using the users module, they asked me to generate a report that shows the list of users that belong to an specific role level and next to the name they also would like the deadline specified on each user for this role (all users have a deadline specified with this specific role).

Can some one point me in the direction of which tables should I use to generate my custom SQL query? I don't know where the deadline for a customize role is located within the DNN database tables.

Regards,

Veteran Member
Posts: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
Standby and I'll whip something up for ya...

David Poindexter


Creator:


Veteran Member
Posts: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
  • Accepted Answer
Let's try this (and see if it gets whacked):

[code]
SELECT
u.Username,
u.DisplayName,
u.Email,
r.RoleName,
ur.ExpiryDate AS RoleDeadline
FROM
dbo.Users u
INNER JOIN dbo.UserRoles ur ON u.UserID = ur.UserID
INNER JOIN dbo.Roles r ON ur.RoleID = r.RoleID
WHERE
r.RoleName = 'YourSpecificRoleName' -- Replace with actual role name
AND ur.ExpiryDate IS NOT NULL
ORDER BY
ur.ExpiryDate, u.Username;
[/code]

David Poindexter


Creator:


Veteran Member
Posts: 363
Veteran Member
4 Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
New Poster
New Poster
Congrats on posting!
4 Engaged Reader
Engaged Reader
You are an engaged reader!
2 Avid Reader
Avid Reader
Avid Reader art thou!
2 Most Liked
Most Liked
Congrats, your posts are really liked!

Dave, thank you! that query worked just fine! Thank you so much for the BIG help. 

Veteran Member
Posts: 360
Veteran Member
Helpful Replier
Helpful Replier
Thanks for being such a helpful replier!
MVP
MVP
You're an MVP!
Happy to hear it worked Marco!

David Poindexter


Creator:


These Forums are for the discussion of the open source CMS DNN platform and ecosystem.

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

  1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
  2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
  3. 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.
  4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  5. No Flaming or Trolling.
  6. No Profanity, Racism, or Prejudice.
  7. Site Moderators have the final word on approving / removing a thread or post or comment.
  8. English language posting only, please.

Would you like to help us?

Awesome! Simply post in the forums using the link below and we'll get you started.

Get Involved