Mastering Jira Query Language (JQL) – A Comprehensive Guide

Jira

Jira is one of the most widely used project management and issue-tracking tools, helping teams organize, track, and manage their work efficiently. One of its most powerful features is Jira Query Language (JQL), a flexible and robust way to search for issues in Jira.

JQL allows users to create complex queries to filter issues based on various criteria such as status, assignee, project, priority, and more. Whether you’re a project manager, developer, or QA engineer, mastering JQL can significantly enhance your productivity in Jira.

In this guide, we’ll cover:

  • What is JQL?
  • Basic JQL Syntax
  • How to Write JQL Queries
  • Common JQL Functions & Operators
  • Step-by-Step Examples
  • Creating a Query for “In Progress” Tickets
  • Advanced JQL Techniques
  • Best Practices

Let’s dive in!

Contents

Mastering Jira Query Language (JQL) – A Comprehensive Guide.

1. What is JQL?.

2. Basic JQL Syntax.

3. How to Write JQL Queries.

Complete List of JQL Functions in Jira.

1. User-Related Functions.

2. Date & Time Functions.

3. Text & String Functions.

4. Issue Linking & References.

5. Aggregate & Statistical Functions.

6. Special JQL Operators.

7. Advanced JQL Functions (Plugins & ScriptRunner)

Conclusion.

1. What is JQL?

JQL stands for Jira Query Language, a text-based search language used to query issues in Jira. Unlike the basic search filters, JQL provides advanced search capabilities, allowing users to construct precise queries using logical operators, keywords, and functions.

Jira software

Key Benefits of JQL:

✔ Precise Filtering – Retrieve exact issues based on multiple conditions.
✔ Advanced Search – Go beyond basic filters with complex logic.
✔ Reusable Filters – Save queries as filters for future use.
✔ Integration with Dashboards & Reports – Use JQL filters in Agile boards and reports.

2. Basic JQL Syntax

A JQL query consists of fieldsoperators, and values structured in a logical format.

Basic Structure:

FIELD OPERATOR VALUE [AND|OR] [FIELD OPERATOR VALUE]…

  • FIELD – A Jira field (e.g., status, assignee, project).
  • OPERATOR – Defines the condition (e.g., =, !=, IN, NOT IN).
  • VALUE – The data to match (e.g., “In Progress”, “John Doe”).

Example:

status = “In Progress” AND assignee = currentUser()

This query retrieves all issues assigned to the current user with a status of “In Progress.”


3. How to Write JQL Queries

Step 1: Accessing the Advanced Search in Jira

  1. Go to Issues → Search for issues.
  2. Click on Advanced to switch to JQL mode.

Step 2: Writing a Simple Query

Let’s start with a basic query:

project = “My Project” AND status = “Open”

This returns all open issues in “My Project.”

Step 3: Using Logical Operators (AND, OR, NOT)

Combine multiple conditions:

project = “My Project” AND (status = “Open” OR status = “In Progress”)

This retrieves all issues in “My Project” that are either “Open” or “In Progress.”

Step 4: Saving the Query as a Filter

After running a query:

  1. Click Save As.
  2. Give it a name (e.g., “My Open and In-Progress Issues”).
  3. Click Submit.

Now, you can reuse this filter in dashboards or reports.


4. Common JQL Functions & Operators

Comparison Operators

OperatorDescriptionExample
=Equalsstatus = “Done”
!=Not equalsstatus != “Done”
Greater thandueDate > “2024-01-01”
Less thancreated < “2024-01-01”
>=Greater than or equalpriority >= “High”
<=Less than or equalvotes <= 5

Logical Operators

OperatorDescriptionExample
ANDBoth conditions must be truestatus = “Open” AND assignee = currentUser()
OREither condition must be truestatus = “Open” OR status = “In Progress”
NOTExcludes matching issuesNOT status = “Closed”

Text Search Operators

OperatorDescriptionExample
~Containssummary ~ “bug”
!~Does not containsummary !~ “test”
IS EMPTYField is emptydescription IS EMPTY
IS NOT EMPTYField is not emptydescription IS NOT EMPTY

Date Functions

Jira software
FunctionDescriptionExample
currentUser()Logged-in userassignee = currentUser()
now()Current timedueDate > now()
startOfDay(), endOfDay()Today’s start/endcreated >= startOfDay()

5. Step-by-Step JQL Examples

Example 1: Find All “In Progress” Tickets

status = “In Progress”

Explanation:

  • status is the field.
  • = is the operator.
  • “In Progress” is the value.

Example 2: Find High-Priority Bugs Assigned to Me

project = “My Project” AND type = “Bug” AND priority = “High” AND assignee = currentUser()

Example 3: Find Issues Updated in the Last 7 Days

jql

Copy

updated >= -7d

  • -7d means “7 days ago.”

Example 4: Find Unresolved Issues with No Assignee

status NOT IN (“Closed”, “Done”) AND assignee IS EMPTY


6. Advanced JQL Techniques

Using IN and NOT IN for Multiple Values

status IN (“Open”, “In Progress”, “Reopened”)

Using WAS to Track Historical Changes

status WAS “In Progress” DURING (“2024-01-01”, “2024-01-31”)

This finds issues that were “In Progress” at any point in January 2024.

Using ORDER BY to Sort Results

project = “My Project” ORDER BY created DESC

This sorts issues by creation date (newest first).


7. Best Practices for Writing JQL Queries

✅ Use Parentheses for Complex Logic – Improves readability and ensures correct evaluation.
✅ Leverage Saved Filters – Avoid rewriting common queries.
✅ Test Queries Incrementally – Start simple and add conditions gradually.
✅ Use JQL Functions – Like currentUser(), now(), etc., for dynamic queries.
✅ Optimize for Performance – Avoid overly broad queries (e.g., project IS NOT EMPTY).

Complete List of JQL Functions in Jira

Jira Query Language (JQL) provides several built-in functions to enhance search capabilities. Below is a comprehensive list of all JQL functions, categorized by their purpose.

1. User-Related Functions

These functions help filter issues based on user information.

FunctionDescriptionExample
currentUser()Returns the currently logged-in user.assignee = currentUser()
membersOf()Finds users who are members of a group.assignee IN membersOf(“developers”)
currentUserGroups()Returns groups the current user belongs to.assignee IN currentUserGroups()

2. Date & Time Functions

These functions help filter issues based on dates and times.

FunctionDescriptionExample
now()Current date and time.dueDate > now()
startOfDay()Start of the current day (midnight).created >= startOfDay()
endOfDay()End of the current day (11:59:59 PM).dueDate <= endOfDay()
startOfWeek()Start of the current week (Monday).updated >= startOfWeek()
endOfWeek()End of the current week (Sunday).dueDate <= endOfWeek()
startOfMonth()Start of the current month.created >= startOfMonth()
endOfMonth()End of the current month.dueDate <= endOfMonth()
startOfYear()Start of the current year.created >= startOfYear()
endOfYear()End of the current year.dueDate <= endOfYear()

3. Text & String Functions

These functions help with text-based searches.

FunctionDescriptionExample
~ (Contains)Searches for text in a field.summary ~ “bug”
!~ (Not Contains)Excludes text in a field.summary !~ “test”

4. Issue Linking & References

These functions help find linked issues.

FunctionDescriptionExample
linkedIssues()Finds issues linked to a given issue.issueFunction in linkedIssues(“ABC-123”)
issueHistory()Searches issue change history.status WAS “In Progress”

5. Aggregate & Statistical Functions

These functions help with calculations and issue statistics.

FunctionDescriptionExample
count()Counts matching issues.issueFunction in count(“status = Open”)
sum()Sums a numeric field.issueFunction in sum(“timeSpent”)

6. Special JQL Operators

These are not functions but powerful operators used in JQL.

OperatorDescriptionExample
WASChecks if a field had a value in the past.status WAS “In Progress”
CHANGEDChecks if a field changed.status CHANGED AFTER startOfWeek()
DURINGChecks if a condition was true during a period.status WAS “Done” DURING (“2024-01-01”, “2024-01-31”)
AFTER, BEFOREFilters based on date ranges.created AFTER “2024-01-01”

7. Advanced JQL Functions (Plugins & ScriptRunner)

Some functions require Atlassian Marketplace plugins (like ScriptRunner):

FunctionDescriptionExample
issueFunction(ScriptRunner) Allows complex queries.issueFunction in subtasksOf(“ABC-123”)
hasAttachments()(ScriptRunner) Checks for attachments.issueFunction in hasAttachments()

Final Notes

  • Standard JQL functions (like currentUser(), now()) work in all Jira instances.
  • Advanced functions (like issueFunction) may require plugins.
  • Always test queries in Jira’s Advanced Search before saving.

Conclusion

JQL is an indispensable tool for Jira users who need precise control over issue tracking. By mastering JQL syntax, operators, and functions, you can create powerful queries to streamline workflows, generate reports, and improve productivity.

Final JQL Query Example (All “In Progress” Tickets)

status = “In Progress” ORDER BY updated DESC

This retrieves all issues in “In Progress” status, sorted by the most recently updated.

Start experimenting with JQL today, and unlock the full potential of Jira’s search capabilities!

For you

Dhakate Rahul

Dhakate Rahul