How to get the opened, resolved and outstanding bugs for each fix versions?

I already extracted for project wise by using below query but i need to add fix versions condition to this below query. How to do that?

 

SELECT 
B_DATE AS `DATE`, Project_Id AS `PROJECT ID`, `PROJECT NAME`,
Opend AS OPENED, Rslvd AS RESOLVED,
(@runtot := IF(Project_Id = @prev_project, ((@runtot+Opend) - Rslvd),(Opend - Rslvd))) AS Outstanding,
@prev_project := Project_Id AS temp_project
FROM (
SELECT bc.B_DATE, bc.Project_Id,
pr.pname AS `PROJECT NAME`,
MAX(CASE WHEN bc.BUG_status = 'O' THEN bc.Bug_cnt ELSE 0 END) AS Opend,
MAX(CASE WHEN bc.BUG_status = 'R' THEN bc.Bug_cnt ELSE 0 END) AS Rslvd FROM (
SELECT DATE(CREATED) AS B_DATE, 'O' AS BUG_status, project AS Project_Id,
COUNT(DISTINCT(ID)) AS Bug_cnt FROM jiraissue
GROUP BY DATE(CREATED), project
UNION ALL
SELECT DATE(UPDATED) AS B_DATE, 'R' AS BUG_status, project AS Project_Id,
COUNT(IF(issuestatus = 5 OR issuestatus = 6 OR issuestatus = 10109,issuestatus,NULL)) AS Bug_cnt
FROM jiraissue GROUP BY DATE(UPDATED), project) bc LEFT OUTER JOIN project pr ON (bc.Project_Id = pr.ID)
GROUP BY bc.B_DATE, bc.Project_Id
ORDER BY bc.Project_Id) bcc , (SELECT @runtot:=0, @prev_project := NULL) c

 

Immediate assistance will be more appreciate-able. 

1 answer

0 votes

 

The SQL for your request is painful, complex, inefficient and very prone to error.  You're going to have to join another three tables into it multiple times.

SQL is the WORST possible way to do any reporting in Jira.  Please, stop.

JQL for "project in (x, y, z) and issuetype = bug" in a 2 dimensional filter gadget with status and version as the axes will answer your question far faster and easier, and you might find the version reports can help your users with the details as well.

@Nic Brough [Adaptavist], But my requirement to create a report tableau. So, I will collect this data via tableau and creating the report.

I don't have any other chance to move around other than SQL. Because some other non-jira reports are dependency to this report. Can i get some idea?

"Create a report with Tableau" is not a requirement, it's a solution.  And, in this case, it's the wrong solution.

Your requirement is reporting on the status of bugs.  Jira does that already.

Re-inventing a wheel that will be poorly implemented, liable to failure and likely to cause more issues is the wrong thing to do.

But, if you must, then you need to join the nodeassociation table, many times, to each issue, then use the results to read the projectversion table.

Is it safe to assume your SQL will be run against a replicated copy of the Jira database by the way?  If it is not, then you're going to cause performance issues in production if you continue down this road.

I done it with myself. Thanks for you suggestion and i will not pull data from production. We have done master, slave replication. So all my request will go to slave only.

 

"Create a report with Tableau" is not a requirement, it's a solution.  And, in this case, it's the wrong solution. -- Sorry to say, you have taken it wrongly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 29, 2018 in Jira

How to set up an incident workflow from the VP of Engineering at Sentry

Hey Atlassian community, I help lead engineering at Sentry, an open-source error-tracking and monitoring tool that integrates with Jira. We started using Jira Software Cloud internally last year, a...

1,101 views 0 8
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you