Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Jira SQL Query to Return all Labels from the Label field from a Specific Project

Hello and thanks in advance for the help.

Is there a way to write a  SQL query to return a list of all labels used in a project A and the issues associated with it? 

Essentially i want to run a SQL query but instead of the version, i want to see the labels used in the label field for a specific project 

Project, Project Key, Issue ID, Issue Key, Label

I really need to learn more about querying the Jira DB with SQL

2 answers

2 accepted

4 votes
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 17, 2019

Hi Hamdy,

While you probably could find this info via JQL the way Alex suggests, I did some investigating and I think i found a way to provide what you are looking for here via SQL. 

select p.pkey || '-' || ji.IssueNum as IssueKey, l.label, p.pkey, p.pname
from label l
join jiraissue ji on = l.issue
join project p on ji.project =
order by issuekey asc

This query will return all the labels, and then give you the issue key, project key, and project name.  You will find that issues that have more than one label will be displayed in this list multiple times.   But this is one way to try to organize and understand which labels are used on a per project basis.   You could even restrict this query to only return issues in a specific project with something like:

select p.pkey || '-' || ji.IssueNum as IssueKey, l.label, p.pkey, p.pname
from label l
join jiraissue ji on = l.issue
join project p on ji.project =
where p.pkey='SSP'
order by issuekey asc

This would only return issues in the project with the key SSP.



@Andy Heinzer  Thank you very much. This worked just the way i wanted it. I tried the JQL and i couldn't get it to display the labels distinctly. That is why i figured the SQL route would be my best chance here.

I really need to learn more about SQL for jira. Thank you for all your help.

0 votes
Answer accepted
Alex Gallien
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, 2019

Why do you need this as a SQL query? Have you considered trying to export the issues to a CSV instead - Exporting an Issue? There  is almost always a better way to report on your data then directly pulling it from the database.

I did . JQL doesn't allow me to export it the way i'd like.

As you know, a multiple labels can be used in one issue. But i want my list to be a list of distinct labels. When i try with JQL and try exporting it gives me a list of distinct issues with a label column containing multiple labels

Suggest an answer

Log in or Sign up to answer