SQL: Query for getting project name, start date and end date using sprint table

Srinivas October 31, 2016

I want to write a sql query which shows me all Project Names, Start Date and End Date based on project sprint mapping..

Thank you in advance.

2 answers

1 vote
Peter Geshev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 1, 2016

Hi Srinivas,

try the following query (10004 is the id of the sprint customfield)

SELECT p.pname as project, min(s."START_DATE"), max(s."END_DATE")
FROM "jiraissue" i
JOIN "customfieldvalue" cf ON cf.issue = i.id AND cf.customfield = 10004
JOIN "AO_60DB71_SPRINT" s ON s."ID" = cf.stringvalue::int
JOIN "project" p ON p.id = i.project
GROUP BY p.pname

Regards,

Peter

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 1, 2016

Remember that this can give you many projects and sprints - sprints do not belong to projects, or vice-versa, it's a many:many relationship.

0 votes
Srinivas November 2, 2016

Thanks for the response. As per above query i don't have any custom field.

My requirement as fallows.

 

Project IdProject NameStart DateEnd Date
1A22/10/201522/10/2016
2B22/10/201522/08/2016
3C22/10/201522/10/2016
4D22/10/201522/10/2016

Start Date:  Project first Sprint  start date

End Date:  Project end Sprint  end date ( if sprint is not completed as per today date it should be empty)

Thank you.

Peter Geshev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 2, 2016

You have a sprint custom field (which associates an issue with a sprint) created implicitly by JIRA software/JIRA agile - you will have to check its id manually and replace it in the query, as it is different for different JIRA instances. The above sql will return start and end dates as seconds since epoch - you will have to convert them to date manually, depending on the type of your db server

Srinivas November 2, 2016

Thank you for quick response

Suggest an answer

Log in or Sign up to answer