JIRA Advanced JQL
Basic JQL finds issues by simple field values. Advanced JQL answers sharper questions: which issues changed status this week, which sprints stay open, which tasks sat untouched for two weeks. Functions, history keywords, and sorting rules unlock these searches.
Anatomy of a JQL Query
Every query combines fields, operators, and values. Keywords such as AND, OR, and ORDER BY join the pieces.
project = WEB AND status != Done AND assignee = currentUser() ORDER BY priority DESC |______________| |___________| |____________________| |____________________| condition 1 condition 2 condition 3 sorting rule
Operator Quick Reference
Common JQL Operators
| Operator | Meaning | Example |
|---|---|---|
| = | Equals | status = "In Progress" |
| != | Does not equal | priority != Low |
| IN | Matches any value in a list | status IN ("To Do", "In Progress") |
| NOT IN | Matches none of the listed values | issuetype NOT IN (Epic, Subtask) |
| ~ | Contains text | summary ~ "login" |
| IS EMPTY | Field has no value | assignee IS EMPTY |
| >, <, >=, <= | Compares numbers and dates | created >= -7d |
Date Functions
Date functions adjust automatically, so a saved filter stays fresh every day.
Useful Date Functions
| Function | Returns |
|---|---|
| now() | The current moment |
| startOfDay() | Midnight at the start of today |
| startOfWeek() | The first moment of the current week |
| startOfMonth() | The first moment of the current month |
| endOfWeek() | The last moment of the current week |
Relative dates work too. The value -14d means fourteen days ago, and 3d means three days from now.
User, Sprint, and Version Functions
- currentUser() returns the person who runs the search.
- membersOf("group") returns every user in a group.
- openSprints() returns sprints that run right now.
- closedSprints() returns finished sprints.
- futureSprints() returns planned sprints that have not started.
- unreleasedVersions() returns versions that have not shipped.
- releasedVersions() returns versions that already shipped.
History Searches
JIRA remembers every change to an issue. History keywords search that memory.
History Keywords
| Keyword | Question It Answers | Example |
|---|---|---|
| WAS | Did the field ever hold this value? | status WAS "In Review" |
| WAS NOT | Did the field never hold this value? | status WAS NOT "Done" |
| CHANGED | Did the field change? | status CHANGED AFTER startOfWeek() |
| CHANGED FROM ... TO | Did the field move between two values? | status CHANGED FROM "To Do" TO "In Progress" |
Sorting Results
ORDER BY arranges the results. ASC sorts low to high, and DESC sorts high to low. Multiple rules separate with commas.
ORDER BY priority DESC, created ASC
That rule lists urgent issues first and shows the oldest of them at the top.
Grouping Conditions with Parentheses
Parentheses control the order of evaluation. A query without them can return surprising results.
project = WEB AND (status = "To Do" OR status = "In Progress")
Without the parentheses, JIRA reads the OR part as a separate branch and may return issues from other projects.
Ready-to-Use Queries
Real-World JQL Examples
| Goal | Query |
|---|---|
| My open work | assignee = currentUser() AND resolution = Unresolved |
| Overdue issues | duedate < now() AND resolution = Unresolved |
| Created this week | created >= startOfWeek() |
| Stale issues | updated <= -14d AND statusCategory != Done |
| Current sprint work | sprint IN openSprints() AND project = WEB |
| Unassigned bugs | issuetype = Bug AND assignee IS EMPTY |
Common Mistakes
- Forgetting quotes around values with spaces, such as "In Progress".
- Using = on text fields where ~ fits better.
- Mixing AND with OR without parentheses.
- Copying a query with curly quotes from a document. JQL needs straight quotes.
Summary
Advanced JQL builds on basic searches with functions, history keywords, and sorting rules. Date functions keep filters current. History searches reveal what changed and when. Parentheses protect the logic of complex queries. A small library of saved queries answers daily questions in seconds.
