accessNator
Registered User.
- Local time
- Today, 12:33
- Joined
- Oct 17, 2008
- Messages
- 132
I am trying to convert this query I have in TSQL. I am running into problems on the proper syntax. This is the original syntax.
So far, I think I have it converted to the following, ,but Im still having problems with the proper joins and parenthesis.
I would appreciate any assistance.
Thanks.
Code:
SELECT
u.UserID,
u.FirstName,
u.LastName,
u.Username,
u.Email,
u.DisplayName,
up1.PropertyValue AS TypeOfAccess
FROM
dbo.dnn_users AS u INNER JOIN
dbo.dnn_UserRoles AS ur ON u.UserID = ur.UserID INNER JOIN
dbo.dnn_Roles AS r ON ur.RoleID = r.RoleID AND r.RoleName = N'Agent' LEFT OUTER JOIN
(SELECT
up.UserID,
up.PropertyValue
FROM
dbo.dnn_UserProfile AS up INNER JOIN
dbo.dnn_ProfilePropertyDefinition AS ppd ON
up.PropertyDefinitionID = ppd.PropertyDefinitionID AND
ppd.PropertyName = 'TypeOfAccess' AND
ppd.PortalID = 0) AS up1 ON u.UserID = up1.UserID
Code:
SELECT
u.UserID,
u.FirstName,
u.LastName,
u.Username,
u.Email,
u.DisplayName,
up1.PropertyValue AS TypeOfAccess
FROM
(dbo.dnn_users AS u INNER JOIN
dbo.dnn_UserRoles AS ur ON u.UserID = ur.UserID) INNER JOIN
dbo.dnn_Roles AS r ON ur.RoleID = r.RoleID AND r.RoleName = "Agent" LEFT OUTER JOIN
(SELECT
up.UserID,
up.PropertyValue
FROM
dbo.dnn_UserProfile AS up INNER JOIN
dbo.dnn_ProfilePropertyDefinition AS ppd ON
up.PropertyDefinitionID = ppd.PropertyDefinitionID AND
ppd.PropertyName = "TypeOfAccess" AND
ppd.PortalID = 0) AS up1 ON u.UserID = up1.UserID
Thanks.