There is a Sample Report named IssuesAndRisks which fetches fields from Project Server Reporting Databases. We want to add a few fields from Content Database UserData table to this report both for Issues and Risks reports.
How best to join this report with the UserData table in the Content database so that no record from original report is lost?
For reference the original built-in query for these reports is :
For Issues Report the query is :
-----------------------------------
SELECT ProjectOwner.ProjectUID as [ProjectUID],
ProjectOwner.ProjectName as [ProjectName], ProjectOwner.ProjectStartDate as [ProjectStartDate], ProjectOwner.ProjectFinishDate as [ProjectFinishDate], MSP_WssRelationshipType.RelationshipTypeID as [RelationshipTypeID], MSP_WssRelationshipType.Description as [RelationshipDescription], MSP_WssIssueToTaskLinks_UserView.IssueID as [IssueID], MSP_WssIssueToTaskLinks_UserView.Title as [Title], MSP_WssIssueToTaskLinks_UserView.AssignedToResource as [AssignedToResource], MSP_WssIssueToTaskLinks_UserView.NumberOfAttachments as [NumberOfAttachments], MSP_WssIssueToTaskLinks_UserView.DueDate as [DueDate], MSP_WssIssueToTaskLinks_UserView.Category as [Category], MSP_WssIssueToTaskLinks_UserView.Status as [Status], MSP_WssIssueToTaskLinks_UserView.Priority as [Priority], MSP_WssIssueToTaskLinks_UserView.Owner as [Owner], MSP_WssIssueToTaskLinks_UserView.Discussion as [Discussion], MSP_WssIssueToTaskLinks_UserView.Resolution as [Resolution], MSP_WssIssueToTaskLinks_UserView.CreateByResource as [CreateByResource], MSP_WssIssueToTaskLinks_UserView.CreatedDate as [CreatedDate], MSP_WssIssueToTaskLinks_UserView.ModifiedByResource as [ModifiedByResource], MSP_WssIssueToTaskLinks_UserView.ModifiedDate as [ModifiedDate], TaskRelated.TaskUID as [TaskUID], TaskRelated.TaskName as [TaskName], TaskRelated.TaskStartDate as [TaskStartDate], TaskRelated.TaskFinishDate as [TaskFinishDate]
FROM dbo.MSP_WssIssueToTaskLinks_UserView LEFT OUTER JOIN dbo.MSP_EpmProject_UserView AS ProjectOwner ON
ProjectOwner.ProjectUID = MSP_WssIssueToTaskLinks_UserView.ProjectUID LEFT OUTER JOIN dbo.MSP_EpmProject_UserView AS ProjectRelated
ON ProjectRelated.ProjectUID = MSP_WssIssueToTaskLinks_UserView.RelatedProjectUID LEFT OUTER JOIN dbo.MSP_EpmTask_UserView AS TaskRelated ON TaskRelated.ProjectUID = MSP_WssIssueToTaskLinks_UserView.RelatedProjectUID AND TaskRelated.TaskUID = MSP_WssIssueToTaskLinks_UserView.RelatedTaskUID LEFT JOIN dbo.MSP_WssRelationshipType ON MSP_WssIssueToTaskLinks_UserView.RelationshipTypeID = MSP_WssRelationshipType.RelationshipTypeID
ORDER BY ProjectOwner.ProjectName ASC, MSP_WssIssueToTaskLinks_UserView.Title ASC
----------------------------------------------------------
We need to add fields from UserData table to this query.
Similarly we want to add fields from UserData table to Risk report also. The original query for Risks is similar to the above query with MSP_WssIssueToTaskLinks_UserView being replaced by MSP_WssRiskToTaskLinks_UserView.
How best to do it without losing records from original report?