1

我有以下查询:

SELECT COUNT(H.RootID) AS [Anzahl], hlrpttreeitem.displaypath AS Kategorie, DATEPART(month, SRQuery.Datum) AS [Monat]
FROM sereresystem
INNER JOIN sereregeneral ON sereresystem.caseid = sereregeneral.caseid
INNER JOIN sereresperou ON sereresystem.caseid = sereresperou.caseid
INNER JOIN sererekeywordskeyword ON sereresystem.caseid = sererekeywordskeyword.caseid
INNER JOIN Hierarchy H ON sererekeywordskeyword.sererekeywordskeywordid = H.childid
INNER JOIN SRQuery ON sereresystem.referencenumber = SRQuery.Ticketnummer
INNER JOIN SRInnerQuery ON SRQuery.Ticketnummer = SRInnerQuery.Ticketnummer
LEFT JOIN hlrpttreeitem ON hlrpttreeitem.treeitemid = H.RootID
WHERE (sereregeneral.inpcha NOT IN (102800, 102993))
AND (sereresperou.assrol IN (102961, 107075, 107074))
AND hlrpttreeitem.languageid = '7'
AND (DATEPART(month, sereresystem.registrationtime) IN (@Monat))
AND (DATEPART(year, sereresystem.registrationtime) = @Jahr)
AND SRQuery.Anzahl = SRInnerQuery.Anzahl
GROUP BY hlrpttreeitem.displaypath, DATEPART(month, SRQuery.Datum)

在 SRSS 中,我使用矩阵将类别列表(大约 20 个)创建为行,并计算每个类别一年中每个月的值的数量。

有些类别中没有值。

我现在的问题是,我希望它们显示在值为“0”的类别列表中。

我读过关于左连接或外连接的东西,但不能让它们工作。有谁知道我怎么能

4

0 回答 0