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

HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Need help with SQL query please.Need help with SQL query please.
Previous
 
Next
New Post
2/11/2006 5:25 PM
 
Hello,

Could somebody please help me with a SQL query that will return to me the Username, PortalID, HTTPAlias, Date of every user that signed up within a date range?

I'm wondering because I run a DNN site with about two thousand portals and about 500 users registering each day.  I'd like to run a SQL that shows me what portals those users are registering on.

Also, is there a way I can track the IP of those who registered?  I'd like to put this in the Users table.

Any help would be much appreciated.  Thx!

 
New Post
2/12/2006 12:34 PM
 

You could try something like this;

SELECT Users.Username, UserPortals.UserPortalId, Portals.PortalName, PortalAlias.HTTPAlias, UserPortals.CreatedDate

FROM Users INNER JOIN

UserPortals ON Users.UserID = UserPortals.UserId INNER JOIN

Portals ON UserPortals.PortalId = Portals.PortalID INNER JOIN

PortalAlias ON Portals.PortalID = PortalAlias.PortalID

Cheers,


Paul Davis
 
New Post
2/13/2006 1:45 AM
 

Whoa... VERY nice!!!

Could I get you to fix in 1 tiny change?  Some of my sites have multiple portal alias, and with that query it has 1 result per portal alias.  Is there a way you can make it only give 1 result when the Username and UserPortalID are the same?

Thx :)

 
New Post
2/13/2006 10:54 AM
 

There probably is but I can't for the life of me remember what it is right now. (Still down one cup of coffee).  The main problem with doing that is there is a one to many relationship between the portalID and the HTTPAlias.  So when I call the portalID for the user I get say PortalID =1, then go to tac on the HTTPAlias and I get results for each entry with a portalID of 1. I'm not 100% sure there is a way to limit that in SQL I would normally take the recordset in code and limit the output  in VB that way I always had all the data I asked for if I wanted to use it later.

I'll keep playing with it though to see if I can remember how. :)  In the mean time you can add an order by clause to make it easier to read;

ORDER BY Users.Username, PortalAlias.HTTPAlias

To sort things by Username and then by Alias.  Just change out Username for other column names to sort by them.

 


Paul Davis
 
New Post
2/14/2006 12:32 AM
 
Adeian wrote

There probably is but I can't for the life of me remember what it is right now.

You can figure it out - I know it!  I have faith :)

 
Previous
 
Next
HomeHomeGetting StartedGetting StartedInstalling DNN ...Installing DNN ...Need help with SQL query please.Need help with SQL query please.


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