How to get a list of subtasks associated with a ticket? (sql query)

Alok Band May 16, 2012

Hi,

I am trying to build a sql query where I can find subtask with associated jira bug. There can be multiple subtasks with different types of subtasks . Can someone please recommend appropriate pointers.

Thanks

3 answers

1 vote
Norman Abramovitz
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.
May 16, 2012

WIll this JQL work for you ? I am running on Jira 5.0.4.

issuetype = sub-task and parent = <issue identifier>

It will display all the subtasks associated with the Jira <issue identifier>

Alok Band May 16, 2012

Thanks Norman for response, I am working on sql query in order to filet further by other parameters.

0 votes
CEDRIC ZABEL
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.
May 16, 2012

You seem to be asking many questions about making SQL queries against the Jira database. If you haven’t seen the documentation for Jira’s database schema yet, you can find it at

https://developer.atlassian.com/display/JIRADEV/Database+Schema

0 votes
CEDRIC ZABEL
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.
May 16, 2012

The relationship between subtasks and parents are stored in the issuelink table. This table contains all the issue links, including blockers, duplicates, related issues, etc. For each entry in the issuelink table, you can tell what type of link it represents by looking at the LINKTYPE field.

The LINKTYPE field will contain a numeric ID. That ID is a key of the issuelinktype field. Since you’re interested in subtasks, you’ll be interested in the issuelinktype whose LINKNAME is “jira_subtask_link”.

That should be enough to get you started.

Alok Band May 16, 2012

Cedric,

Thanks for response, I am still working on the query :(

Suggest an answer

Log in or Sign up to answer