简体   繁体   English

SQL Server 2008 SSRS

[英]SQL Server 2008 SSRS

Below is my DATA TABLE 以下是我的数据表

Group RecvDate StartDate EndDate Status 组RecvDate StartDate EndDate状态

d        7/1/2014                            Pending
d        7/2/2014     7/2/2014   7/2/2014    Completed
d        7/3/2014                            Pending
d        7/4/2014     7/4/2014   7/4/2014    Completed

![enter image description here][1] Now what i want do, I want count of status pending like below table. ![在此处输入图片描述] [1]现在我想做的是,我想要等待状态计数,如下表所示。

Result Table:- 结果表:-

Group Date range Pending 组日期范围待定

d          7/1/2014        1
d          7/2/2014        1
d          7/3/2014        2
d          7/4/2014        2

I am new in SSRS. 我是SSRS的新手。 It will be so helpful if any one give me the concept on that. 如果有人给我这个概念,那将非常有帮助。

Thanx in advance. 提前感谢。

If I understood requirement correctly, you wanted to group by date and status. 如果我正确理解了需求,那么您想按日期和状态分组。

Select col1, col2, case when col4='Pending' then 1 else 2 end as c
from t
group by 
col1, col2, case when col4='Pending' then 1 else 2 end as c

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

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