SQL count open tasks each day

三世轮回 提交于 2019-12-13 02:47:45

问题


I've tried to use the search function and found a similar question. However, I can't get it to work properly.

I have a simple table that shows incoming and ended e-mails (tasks). There's an ingoing and ended-date.

For analysis I want to show (historical) the number of open/unanswered e-mails for a given day back in time. The output should answer the question: "What was the number of open tasks yyyy-mm-dd?".

The number of open tasks a given day (yyyy-mm-dd) should be

Count WHERE Date_IN < yyyy-mm-dd 
AND Date_END >= yyyy-mm-dd 
OR Date_IN < yyyy-mm-dd AND Date_END Is Null 

Hope this makes sense. It's a pretty simple "inventory report" where the inventory is tasks.

I've tried to draw an output-example (When Date_END Is Null then task is still open).

来源:https://stackoverflow.com/questions/19382314/sql-count-open-tasks-each-day

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!