Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SQL query

Olexandr Polinkevych
Contributor
June 13, 2018

How to select all issues that in project1 and custom_field = "value" directly from database?
I need it in order to get issues without checking permissions. 
JQL example: project = proj1 and custom_field1 = value

3 answers

1 accepted

1 vote
Answer accepted
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 13, 2018

You can probably find this information in SQL with a query like this:

select cfv.issue, cfv.stringvalue, cf.cfname, P.PKey || '-' || issue.IssueNum as IssueKey
from CustomFieldValue cfv
join CustomField CF on CF.Id = CFV.CustomField
join jiraissue issue on issue.id = cfv.issue
join Project P on issue.Project = P.Id
where P.pkey='SCRUM' and cf.cfname='text1';

This works in postgresql, but the syntax might be different for other database types.  In my case my project key here is called 'SCRUM' and my custom field name is 'text1' (both without quotes.

Olexandr Polinkevych
Contributor
June 14, 2018

Thank you a lot, that's exactly what i need!

Like Federico Leonel Gomez likes this
0 votes
Piotr Bojko
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.
June 13, 2018

@Olexandr Polinkevych what does this mean "without checking permissions"? You want to get a specific data despite in JIRA you do not have access because of permissions to them?

Olexandr Polinkevych
Contributor
June 13, 2018

Yes, i do.

0 votes
Nic Brough -Adaptavist-
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.
June 13, 2018

This is a horrible way to get data from Jira, please consider doing it properly instead.

But, if you must, then you will need to join Project (or hard-code the specific project), customfield (or hard-code it again) and customfieldvalue with Jiraissue to find it.  It will also be inaccurate if config has been changed in certain ways, and it will ignore any permissions and security.

Olexandr Polinkevych
Contributor
June 13, 2018

can you provide an example of query pls?

Nic Brough -Adaptavist-
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.
June 13, 2018

It will be quicker for you to work it out for myself.  I would never do it this way, so I've got nothing to hand.

Suggest an answer

Log in or Sign up to answer