SQL Query在JIRA中每天生成每个状态的票证数量

时间:2017-08-09 10:01:34

标签: database postgresql jira reporting

我目前正在尝试生成一份报告,说明每个状态在任何一天的票数。到目前为止,我可以在一天内为单个项目生成此报告/表格。

我想生成一个表,其中包含每个状态中票数的所有日期。

我正在使用PostgreSQL,这是迄今为止的查询(基于他们自己的文档):

SELECT count(*), STEP.STEP_ID
 FROM (SELECT STEP_ID, ENTRY_ID
 FROM OS_CURRENTSTEP
 WHERE OS_CURRENTSTEP.START_DATE < '04.07.2017'
UNION SELECT STEP_ID, ENTRY_ID
 FROM OS_HISTORYSTEP
 WHERE OS_HISTORYSTEP.START_DATE < '04.07.2017'
 AND OS_HISTORYSTEP.FINISH_DATE > '04.07.2017' ) As STEP,
(SELECT changeitem.OLDVALUE::numeric AS VAL, changegroup.ISSUEID AS ISSID
 FROM changegroup, changeitem
 WHERE changeitem.FIELD = 'status'
 AND changeitem.GROUPID = changegroup.ID
UNION SELECT jiraissue.WORKFLOW_ID AS VAL, jiraissue.id as ISSID
 FROM jiraissue) As VALID,
jiraissue as JI
WHERE STEP.ENTRY_ID = VALID.VAL
AND VALID.ISSID = JI.id
AND JI.project = <'PROJECT ID HERE'>
Group By STEP.STEP_ID

0 个答案:

没有答案