Home Forums SQL Server 2008 T-SQL (SS2K8) Combining a Query to Include an Additional Column RE: Combining a Query to Include an Additional Column

  • Is this what you want?

    SELECT p.ProjectUID, p.Project_Status,

    p.ProjectName AS [Project Name], p.ProjectModifiedDate AS [Last Modified],

    po.ResourceName AS [Owner], p.[Project Category],

    p.ProjectStartDate AS [Start], p.ProjectFinishDate AS [Finish],

    p.ProjectBaseline0StartDate AS [Baseline Start],

    p.ProjectBaseline0FinishDate AS [Baseline Finish],

    p.ProjectPercentCompleted AS [Percent Completed],

    mmuv.EntityUID,

    dbo.GetMultipleValues(mmuv.EntityUID) AS [Business Owner]

    FROM dbo.MSP_EpmProject_UserView p

    INNER JOIN [MSPCFPRJ_Business Owner_AssociationView] mmuv

    ON (p.ProjectUID = mmuv.EntityUID)

    LEFT OUTER JOIN

    dbo.MSP_EpmProjectOwner_OlapView po -- THERE's NO JOIN CONDITION HERE!

    WHERE (p.ProjectType = 0 OR p.ProjectType = 5 OR p.ProjectType = 6)

    I've added an inner join to 'dbo.MSP_EpmProject_UserView ' which is the base table for both queries.

    The two fields are added at the end, but you can place them in any position.

    I assume the missing join condition exists in the real query...