• Community
  • Products
  • Jira
  • Questions
  • SQL Query to get issue id of all the issues with issue type as Defect, status as closed of a particular project and for a particular version in Jira 6.1

SQL Query to get issue id of all the issues with issue type as Defect, status as closed of a particular project and for a particular version in Jira 6.1

SQL Query to get issue id of all the issues with issue type as Defect, status as closed of a particular project and for a particular version in Jira 6.1

2 answers

0 vote

I'd do that in JQL in Jira, not SQL. It's easier to construct, faster, respects security, and you can save it as a filter which is dynamic, exportable, shareable and can be used as the basis for reports.

In JQL,

issuetype = Defect and status = closed and project = <xyz> and version = <123>

In SQL, you'll need to join issue to issuetype, nodeassociation, project and status to begin with...

Nic,

I have a query that'd do that in Jira 5.0.7 and the query goes -> "SELECT vname FROM projectversion, nodeassociation, jiraissue WHERE ASSOCIATION_TYPE = 'IssueFixVersion' AND SINK_NODE_ID = projectversion.id AND SOURCE_NODE_ID = jiraissue.id AND pkey like '"+pkey+"'"

Since, in Jira 6.1, pkey column in table jiraissue has been removed and a new column has been added "issuenum", I am facing this problem in my java code.

Two things spring to mind:

1. You should NOT be embedding SQL in Java code. Why are you not simply using a proper internal JQL call which will be faster, safer and would have continued to work fine after your upgrade?

(And seriously, consider moving to JQL, because it will work)

hello Rohan,

you said that pkey is completely removed but it is present along with issuenum. check once again.

Also it is safe to use JQL rather using SQL as Nic Suggested.

Hi Bharadwaj,

pkey exists, but it has null values for all the entries in the table.

Also the code has already been written and since we are planning to migrate to Jira 6.1 we are facing this problem. This is a small application which has been added to a plugin(created by my team) to fetch issue details and populate the values in an excel sheet. I just need an sql query with some modification that will give the issueid(ex:- JST-1041) of the issues with a particular fixed version value of a project.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

5 ways you can make the most of Jira Software and Bitbucket Cloud

As part of the Bitbucket product team I'm always interested in better understanding what kind of impact the use of our tools have on the way you work. In a recent study we conducted of software devel...

118 views 0 5
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