Created
March 19, 2020 13:56
-
-
Save dorkness-io/5dd0cb597669fce42b13bfcb37033808 to your computer and use it in GitHub Desktop.
Query that sums up worklog entries for a project for the past 7 days. It then ranks and outputs the top 3 projects.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with cte as | |
( | |
select | |
ss.pname | |
,ss.time_worked | |
,rank() over (order by ss.time_worked desc) project_rank | |
from | |
( | |
select | |
p.pname | |
,sum(w.timeworked) as time_worked | |
from | |
jiraissue ji | |
join project p | |
on ji.project = p.id | |
join worklog w | |
on ji.id = w.issueid | |
where w.created >= current_date - interval '7 day' | |
group by 1 | |
) ss | |
) | |
select * from cte | |
where project_rank <=3; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example Output: