• 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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

244 views 1 18
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