简体   繁体   English

由SSRS确定的存储过程中的动态分组

[英]Dynamic Grouping in stored procedure determined by SSRS

I have an SP, who's Count(ColX) changes depending on which column I am grouping by. 我有一个SP,他的Count(ColX)会根据我分组的列而变化。 I have 4 tables in a report in SSRS (VS 2013) that all use the this SP select, but each table will have a different count due to each table grouping by a different column in this SP. 我在SSRS(VS 2013)的报告中有4个表都使用此SP选择,但是由于每个表按此SP中的不同列分组,因此每个表的计数都不同。

Is it possible to keep one SP and group in this SP differently for each table this SP is called in in SSRS? 对于在SSRS中调用此SP的每个表,是否可以在该SP中保留一个SP和一个组,以不同的方式进行?

Eg Table A will group by ColX first, Table B will group by ColY first, etc. 例如,表A首先按ColX分组,表B首先按ColY分组,依此类推。

If you mean that you have a single fixed stored procedure and you want to take the output from that and use it in four different tables in your report design, each grouping the data differently, then yes. 如果您是说您有一个固定的存储过程,并且想从中获取输出,并在报表设计的四个不同表中使用它,则每个表对数据的分组方式都不同,那么可以。

SSRS does not care where the data came from, the results of the stored procedure are passed to SSRS. SSRS不在乎数据来自何处,存储过程的结果将传递给SSRS。 Each table then determines how it will display that data. 然后,每个表确定如何显示该数据。

Think of the tables in your report as SQL views. 将报表中的表视为SQL视图。 You can have a single database table and write many views over it, each giving you different output. 您可以有一个数据库表并在其上写许多视图,每个视图都为您提供不同的输出。

If this is not what you mean then my apologies, you've just wasted 30 seconds of your life reading this! 如果这不是您的意思,那么我道歉,您已经浪费了30秒钟来阅读这篇文章!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM