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

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
6/30/2011 5:26 PM
 
Note: I edited the code below to correct the script syntax.

Using part of Sebastian SQL Script, I have an access database within my office that I have these tables linked via ODBC. What I would like to do is create an equivalent using MS Access query. The SQL script works on the SQL database when I query the records, but I would like to do the same in MS Access. Can anybody translate the query in MS Access?

SELECT Top 1000 UP.PortalID, U.CreatedOnDate, U.UserID, UserName, FirstName, LastName, Displayname, Email,
Street, City, PostalCode -- << User Profile Properties
FROM dbo.dnn_Users U
INNER JOIN dbo.dnn_UserPortals UP ON U.UserID = UP.UserID
-- access each Profile Property:
LEFT JOIN (SELECT PortalID, UserID, PropertyValue Street FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON
PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'Street' ) P_Street ON P_TypeOfAccess.PortalID = UP.PortalID AND P_Street.UserID = U.UserID
LEFT JOIN (SELECT PortalID, UserID, PropertyValue City FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'City' ) P_City ON P_kusfCompanyCode.PortalID = UP.PortalID AND P_City.UserID = U.UserID
LEFT JOIN (SELECT PortalID, UserID, PropertyValue PostalCode FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'PostalCode' ) P_City ON P_PostalCode.PortalID = UP.PortalID AND P_PostalCode.UserID = U.UserID
Order by PortalID, UserID,LastName, FirstName

 I have been trying to recreate it in access, but I am running into syntax problems.

I appreciate any help,
Chuck

 
New Post
6/30/2011 5:45 PM
 
Forgive me, this is the correct syntax that I am trying to convert to MS Access:

SELECT Top 1000 UP.PortalID, U.CreatedOnDate, U.UserID, UserName, FirstName, LastName, Displayname, Email,
Street, City, PostalCode -- << User Profile Properties
FROM dbo.dnn_Users U
INNER JOIN dbo.dnn_UserPortals UP ON U.UserID = UP.UserID
-- access each Profile Property:
LEFT JOIN (SELECT PortalID, UserID, PropertyValue Street FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON
PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'Street' ) P_Street ON P_Street.PortalID = UP.PortalID AND P_Street.UserID = U.UserID
LEFT JOIN (SELECT PortalID, UserID, PropertyValue City FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'City' ) P_City ON P_City.PortalID = UP.PortalID AND P_City.UserID = U.UserID
LEFT JOIN (SELECT PortalID, UserID, PropertyValue PostalCode FROM dbo.dnn_ProfilePropertyDefinition PD INNER JOIN dbo.dnn_UserProfile P ON PD.PropertyDefinitionID = P.PropertyDefinitionID WHERE PropertyName = N'PostalCode' ) P_PostalCode ON P_PostalCode.PortalID = UP.PortalID AND P_PostalCode.UserID = U.UserID
Order by PortalID, UserID,LastName, FirstName
 
New Post
6/30/2011 7:08 PM
 
Pretty sure that MS Access doesn't support selecting "top 1000" ... that is SQL Server T-SQL specific afaik. Maybe Sybase too. At any rate, it's not part of an ansii sql specification and MS Access and SQL Server don't share much in the way of divergences from ansii sql.



There may be more to change ... SQL in MS Access is a pain IMHO ... but start there and you may get lucky


pmgerholdt
 
New Post
7/4/2011 5:15 AM
 
Michael Gerholdt wrote:
Pretty sure that MS Access doesn't support selecting "top 1000" ... that is SQL Server T-SQL specific afaik. Maybe Sybase too. At any rate, it's not part of an ansii sql specification and MS Access and SQL Server don't share much in the way of divergences from ansii sql.

 SELECT TOP ... is part of  ANSI SQL and supported by Jet Engine (Access) as well.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
7/4/2011 5:17 AM
 
Chuck,
I suggest linking the tables within your MS Access database and use Access query builder. You may use subqueries for each property.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
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