我将此问题发布为较早的问题,并清除了一些错误。我正在发布一个新问题,因为我现在正在处理不良结果。我正在尝试计算给定日期(理想情况是在一个时间范围之间,但现在仅在具有条目的日期)的“未解决”问题。
我的数据简化为:IssueID,CreationDate,CompletionDate
我想统计未解决的问题,即Year(CompletionDate)= 1900并且它们在未解决时是累积的,即:如果昨天有1个问题在今天也有1个问题在开,那么今天的计数打开的值为2。解决后,它们应该下降(Year(CompletionDate)<> 1900)。请帮我以为我要关闭了吗?
我只能每天正确返回此输出,但是不能解释在特定时间(Legacy_Open_Issue)仍然存在的先前问题。
SELECT
created_date,
aOpen_Today + Legacy_Open_Issue - Resolved_Issue as totopen
FROM(
SELECT
convert(varchar(10), cast(i.CreationDate as date), 101) as created_date,
sum( case when YEAR(i.CompletionDate)=1900 then 1 else 0 end) as aOpen_Today,
sum( case when (YEAR(i.CompletionDate)<>1900 AND (i.CompletionDate >= i.CreationDate)) then 1 else 0 end ) as Legacy_Open_Issue,
coalesce(tot,0) as Resolved_Issue
FROM Issues i
LEFT JOIN (
SELECT count(IssueID) as tot, CompletionDate as resolved
FROM Issues
WHERE YEAR(CompletionDate)<>1900 group by CompletionDate
)x ON x.resolved = i.CreationDate
GROUP BY convert(varchar(10), cast(i.CreationDate as date), 101), coalesce(tot,0)
) AS y;
My Data is
IssueID CreationDate CompletionDate
1 1/15/2019 1/1/1900
2 1/16/2019 1/17/2019
3 1/16/2019 1/1/1900
4 1/20/2019 1/21/2019
5 1/28/2019 1/1/1900
6 1/30/2019 1/1/1900
My Output is
created_date totopen
1/15/2019 1
1/16/2019 2
1/20/2019 1
1/28/2019 1
1/30/2019 1
My Output SHOULD be
created_date totopen
1/15/2019 1
1/16/2019 3
1/20/2019 3
1/28/2019 3
1/30/2019 4
答案 0 :(得分:2)
我想你想要
docker-compose up
这将累加创造和完成的总和,以获取每天的净额。
答案 1 :(得分:1)
logoAnimation = (AnimationDrawable) logoAnimHolder.getBackground();