Reputation: 51
The main table on the jira database has no information about subtasks.
I'm trying to find all subtasks from a given parent issue using the SQL and not the JIRA web interface.
Where is this information located?
Upvotes: 1
Views: 3006
Reputation: 1
The issuelink table is the table to use but you must realize that the table is also used for other task relationships as well (blocks, clones, duplicates, etc) so that means if you are only looking for subtasks you must indicate the specific link type you are looking for. Thus the proper query would be:
SELECT jiraschema.issuelink.DESTINATION AS childID
FROM jiraschema.issuelink
INNER JOIN jiraschema.issuelinktype
ON jiraschema.issuelink.LINKTYPE = jiraschema.issuelinktype.ID
WHERE jiraschema.issuelinktype.pstyle = 'jira_subtask'
jiraschema.issuelink.SOURCE = [parent_issue_id]
Upvotes: 0
Reputation: 41
I found that not only:
There is viable variant exist too, when:
So, that's means thats links can have two directions.
Upvotes: 0
Reputation: 51
In Jira, the parent issue, child issue/subtask relationship is stored in the table issuelink.
The issue link table has the following fields:
| id | linktype | source | destination | sequence |
The following query will return the children of the parent issue:
SELECT destination AS children FROM issuelink WHERE source=XXX;
Upvotes: 2