Select Query for Count of Issues according to Customfield -(SelectList ) with its None Option

Hi ,

I am writing SELECT queries for JIRA DB, i want to fetch results : Number of issues for a customfield "Severity" .Severity has three options as "High","Low","Medium".

I am able to get the values for severity Customfield by using GROUP BY clause.

But i also want the count of isssues where the value of Severity field is None in JIRA.

The below query gives me results for Customfield Severity for a certain Project & Issuetype:

SELECT cfo.customvalue AS "Severity" ,COUNT(jiraissue.id) AS IssueCount
FROM customfieldoption cfo, jiraissue,
customfieldvalue cfv,
customfield cf
WHERE jiraissue.project='10141'AND jiraissue.created>='2012-04-01' AND jiraissue.issuetype='1' AND cfo.customfield = '10781' AND cfo.customfield = cf.id AND jiraissue.id=cfv.issue AND cfo.id=cfv.stringvalue GROUP BY cfo.customvalue ORDER BY cfo.customvalue;

I want to display "None " Option in the above result.

Please let me know how can we do it?

Thanks

Kapil

1 answer

1 accepted

0 vote

You can't really do this - you are looking for an absence of data rather than data that exists. "None" means "there is no data here". Not a "null" or "an affirmitive data value meaning none", it really is nothing.

Let's say you have four issues, one at each level of severity. If you go and look at the database, you will find four issues, but only three customfield values. Because "none" is "no data exists"

My SQL is not strong enough to tell you if you can do derived results because the best answer to the question is to say "total number of issues - number of issues that have data for that customfield"

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,308 views 14 20
Join discussion

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot