Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 在SSRS报告中包含相乘行的结果集_Sql_Tsql_Reporting Services_Ssrs 2008 - Fatal编程技术网

Sql 在SSRS报告中包含相乘行的结果集

Sql 在SSRS报告中包含相乘行的结果集,sql,tsql,reporting-services,ssrs-2008,Sql,Tsql,Reporting Services,Ssrs 2008,我需要把这个问题写进SSRS报告 SELECT s.SR_Service_RecID -- will have 1 result , p.Description -- will have 8 results , t.notes -- will have 5 results FROM SR_Service s LEFT JOIN IV_Product p ON p.SR_Service

我需要把这个问题写进SSRS报告

SELECT  s.SR_Service_RecID    -- will have 1 result
     ,  p.Description         -- will have 8 results 
     ,  t.notes               -- will have 5 results

FROM SR_Service s
     LEFT JOIN IV_Product p
            ON p.SR_Service_RecID = s.SR_Service_RecID
     LEFT JOIN Time_Entry t
            ON t.SR_Service_RecID = s.SR_Service_RecID
此查询将p.Description与t.Notes相乘,得到预期的总行数

结果集:

SR_RecID    Description    Notes
12345       Product 1      Note 1
12345       Product 1      Note 2
12345       Product 1      Note 3
12345       Product 1      Note 4
12345       Product 1      Note 5
12345       Product 2      Note 1
12345       Product 2      Note 2
12345       Product 2      Note 3
12345       Product 2      Note 4
12345       Product 2      Note 5
Etc..
如何将其放入SSRS报告中,使其仅显示实际结果,而不显示乘以的数量

SR_RecID
12345

Description
Product 1
Product 2
Product 3
Product 4
Product 5
Product 6
Product 7
Product 8

Notes 1
Notes 2
Notes 3
Notes 4
Notes 5

我是否需要重做查询,或者这可以在SSRS端完成?

是的,您可以通过添加tablix来实现:

并使用3个相邻组(按每个字段分组),如下所示:

您将得到以下结果:


这是一个很好的解决方案,唯一的问题是如果他有多个
SR_RecID
,我认为就是这样。因为你需要把
sru RecID
作为一个外部组,在内部可以添加
Description
Notes
是的,在这种情况下你是对的,但是在关于输出格式的问题上,我并不完全清楚。这非常有效。非常感谢!对于记录,它是多个SR_recid,因此我创建了外部组。