It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

SQL query to fetch Issues created in certain project between two given dates

Hello!!

Can some one helped me in writing SQL query to fetch from DB directly for below JQL.

Project = "ABC" AND Issuetype in (Task,Story) AND createdDate >= "2019-09-01" and createdDate < "2019-10-01"

Thanks  in Advance!!

Regards

Ramakrishna

2 answers

Here's a search some SQL you can try

For Postgres:

SELECT jiraissue.* FROM jiraissue
INNER JOIN project ON jiraissue.project = project.id
INNER JOIN issuetype ON jiraissue.issuetype = issuetype.id
WHERE
project.pkey IN ('PROJECTKEY')
AND issuetype.pname IN ('Task','Story')
AND jiraissue.created >= '2019-09-01'
AND jiraissue.created < '2019-10-01'
ORDER BY jiraissue.issuenum;

For Oracle:

SELECT jiraissue.* FROM jiraissue
INNER JOIN project ON jiraissue.project = project.id
INNER JOIN issuetype ON jiraissue.issuetype = issuetype.id
WHERE
project.pkey IN ('PROJECTKEY')
AND issuetype.pname IN ('Task','Story')
AND jiraissue.created >= to_date('2019-09-01', 'YYYY-MM-DD')
AND jiraissue.created < to_date('2019-10-01', 'YYYY-MM-DD')
ORDER BY jiraissue.issuenum;

This should give you the issues you are looking for.

select * from jiraissue.ji 
where ji.issuetype in
(select id from issuetype where pname in ('Task','Story'))
and ji.project in
(select id from project where pname in ('ABC'))
-- or
--(select id from project where pkey in ('ABC'))
-- if ABC is the project key instead of the project name
and CREATED > '2019-08-31' -- to get 2019-09-01 included, CREATED is time/hour
and CREATED < '2019-10-01'

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Jira

Demo Den Ep. 7: New Jira Cloud Reports

Learn how to use two new reports for next-gen projects in Jira Cloud:  Cumulative flow diagram and Sprint burndown chart. Ivan Teong, Product Manager, Jira Software, demos the Cumulative ...

314 views 1 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you