In this example, list users who were active in this year (2013):
WITH w_all_user_activities AS (SELECT author, g.created FROM jiraissue i INNER JOIN changegroup g ON i.id = g.issueid INNER JOIN changeitem c ON c.groupid = g.id UNION SELECT author, created FROM jiraaction UNION SELECT reporter, created FROM jiraissue ), w_tmp_latest_user_activities AS (SELECT author, created, RANK() OVER (PARTITION BY author ORDER BY created DESC) dest_rank FROM w_all_user_activities ), w_latest_user_activities AS (SELECT author, created FROM w_tmp_latest_user_activities WHERE dest_rank = 1 ) SELECT * FROM w_latest_user_activities WHERE created >= TO_DATE('2013-01-01', 'yyyy-mm-dd');
No comments :
Post a Comment