Oct14Written by:slhilbert
10/14/2008 8:08 AM 
Dotnetnuke stores a users information in several different tables and it can be hard sometimes to get that piece of information you want.
Someone recently asked in the forums for a way to tie the results entered by users from the Survey module to the users information. The only piece of information they had from the user was the UserID. I cooked up this query quickly as a road map to get them going.
SELECT SurveyResults.SurveyResultID, SurveyResults.SurveyOptionID, SurveyResults.UserID, Users.Username, Users.FirstName, Users.LastName,
aspnet_Membership.Email
FROM SurveyResults LEFT OUTER JOIN
Users ON SurveyResults.UserID = Users.UserID INNER JOIN
aspnet_Users ON Users.Username = aspnet_Users.UserName INNER JOIN
aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId
You can see the complete thread here.
1 comment(s) so far...
Re: Querying Dotnetnuke for Username, Email, Etc with a UserID
If you just want to query all of your users in Dotnetnuke you can do the following:
SELECT Users.UserID, Users.Username, Users.FirstName, Users.LastName, aspnet_Membership.Email FROM Users INNER JOIN aspnet_Users ON Users.Username = aspnet_Users.UserName INNER JOIN aspnet_Membership ON aspnet_Users.UserId = aspnet_Membership.UserId By Stuart on
11/14/2008 9:51 PM
|