0
SELECT tp.ProjectName, tp.ProjectDescription, dev.FullName as 'Developer'
        , o.FullName as 'Owner', tp.StartDate, tp.EndDate, tp.ProjectStatus, 
        tp.CompletionPct, Count(tb.ProjectID) as 'NumberofBugs'

FROM tblBTProject tp
LEFT JOIN tblBTBugs tb ON tp.ProjectID = tb.ProjectID

--Get user fullnames by ID
LEFT JOIN CollectionsOperationsControl.dbo.tblCOCUser as dev 
    ON tp.Developer = dev.CorpID
LEFT JOIN CollectionsOperationsControl.dbo.tblCOCUser as o 
    ON tp.Owner = o.CorpID


WHERE CAST(CONVERT(VARCHAR(10), tp.CreationDate, 101) AS DATETIME) BETWEEN @StartDate AND @EndDate
AND (tp.Developer  IN (SELECT * FROM dbo.fnSplitList(LTRIM(RTRIM(@Developer)), ',')))
AND (tp.Owner IN (SELECT * FROM dbo.fnSplitList(LTRIM(RTRIM(@Owner)), ',')))


GROUP BY tp.ProjectID, tp.ProjectName, tp.ProjectDescription, dev.FullName, o.FullName, tp.StartDate, tp.EndDate, 
            tp.ProjectStatus, tp.CompletionPct

ORDER BY tp.ProjectID

在上面的代码中,我想返回 tblBTBugs 中 tp.ProjectID 的所有实例的计数(通过 tp.ProjectID 从 tblBTProject 加入)我已将其作为存储过程完成,但在我的报告服务中,当我进行多项选择时'Developer' 和 'Owner' 它只显示每个 'Developer' 或 'Owner' 的一个实例,而不是所有匹配的记录。连接是否存在问题,它只返回每个实例的一个实例?谢谢 PS 我使用 SQL Server 2005 存储过程。它的参数是@StartDate、@EndDate、@Developer 和@Owner fnSplitList 有助于SRSS 中'Developer' 和'Owner' 的多值选择

在报告方面,我使用 =JOIN(Parameters!Developer.Value, “,”) 来分割记录

4

0 回答 0