我有一张看上去像下面的桌子
project|issue|status |story_points|sprint |date |active_sprint
===============================================
FB1 |abc |In Review| 3 |Backlog|2017-06-05|True
FB1 |acc |In Review| 3 |Backlog|2017-06-05|True
FB1 |adc |In Review| 3 |Backlog|2017-06-04|True
FB2 |xyz |In Review| 3 |Backlog|2017-06-05|True预期结果
open|project|date
===============================================
6 |FB1 |2017-06-05
3 |FB1 |2017-06-04
3 |FB2 |2017-06-05我尝试了很长一段时间了,到处都看过了,但我还是想不出这点。我对postgres和视图都很陌生,希望能得到一些帮助。我已经尝试了很多不同的变化,但仍然无法做到这一点。
SELECT
(SELECT COALESCE(SUM(story_points),0) AS "Open" from sample_table WHERE project = 'FB1' AND active_sprint='True' AND (status = 'In Review')) as "Open",
(SELECT 'FB1'::text AS "Project") as "Project",
(SELECT date as Date) as Date from sample_table WHERE project = 'FB1' group by 3发布于 2017-06-05 23:29:11
你可以试试这样的方法:
select project, date1 , sum(story_points)
from asd1
group by project, date1 https://stackoverflow.com/questions/44378080
复制相似问题