Skip to content
KiweelyKiweelyKiweely

Workday WQL vs SQL: Syntax, WHERE Operators, and Limitations

WQL borrows SQL clause order (SELECT, FROM, WHERE, GROUP BY, ORDER BY) but executes against Workday’s object-graph reporting engine rather than relational tables. This guide covers exact WQL WHERE syntax, Related Business Object traversal, and the SQL features WQL omits.

  • Checked against Workday on
  • Applies to Workday Extend
  • 6 min read
  • Published
  • By Kiweely
On this page

Workday Query Language (WQL) copies SQL’s declarative clause order (SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT), so anyone who writes SQL can read a WQL query immediately. Underneath that surface, WQL is a read-only query layer over Workday’s object-graph reporting engine, not a relational database engine: it has no JOIN, UNION, CASE, subqueries, SELECT *, or write statements (INSERT, UPDATE, DELETE).

How WQL Logic Differs from Relational SQL

In standard SQL, the query planner executes set-based relational algebra across normalized tables using arbitrary join keys. In Workday WQL, every query targets a single Workday data source (or a table-backed Prism data source prefixed with cds_), which is bound to one Primary Business Object (PBO) and its pre-defined Related Business Objects (RBOs).

Execution is also governed by Workday’s security model and reporting limits rather than database-level table grants:

  • Every field and data source is filtered at runtime by the calling user’s or Integration System User’s Workday security domains.
  • A single WQL query cannot return more than 1 million rows; queries exceeding that ceiling fail unless narrowed.
  • Query execution times out after 30 minutes on tenanted hosts and 5 minutes through the Workday Cloud Platform API gateway (api.workday.com).

Side-by-Side Comparison: WQL vs Standard SQL

Capability Standard SQL Workday WQL
CapabilityWildcard columns Standard SQLSELECT * Workday WQLNot supported; every field alias must be named explicitly
CapabilityColumn aliasing Standard SQLfield AS alias Workday WQLfield AS alias (required to disambiguate multiple fields from the same RBO)
CapabilityData target Standard SQLTable or view (FROM workers) Workday WQLWorkday data source with optional filter and prompts (FROM workersForHCMReporting(dataSourceFilter = allActiveWorkers))
CapabilityJoining related data Standard SQLINNER JOIN / LEFT JOIN on arbitrary keys Workday WQLPre-wired RBO traversal with curly braces in SELECT (location{locationName}) and WHERE ON for filtering
CapabilityEquality and inequality Standard SQL=, !=, <> Workday WQL=, !=, <>
CapabilityNull checks Standard SQLIS NULL, IS NOT NULL Workday WQLis empty, is not empty
CapabilityPattern matching Standard SQLLIKE '%text%' Workday WQLCase-insensitive contains, not contains, startswith, endswith
CapabilitySet membership Standard SQLIN ('a', 'b') Workday WQLIN ('wid1', 'wid2') or IN (inst_refId = "USA") for instances
CapabilityDistinct values Standard SQLSELECT DISTINCT col Workday WQLOnly inside COUNT(DISTINCT field)
CapabilityConditional logic Standard SQLCASE WHEN ... THEN ... END Workday WQLNot supported in WQL (build a Workday calculated field instead)
CapabilitySet operations and nesting Standard SQLUNION, INTERSECT, subqueries, CTEs Workday WQLNot supported
CapabilityPagination Standard SQLLIMIT and OFFSET clauses Workday WQLLIMIT in query (1 to 999,999); REST API URL parameters limit (max 10,000 per page) and offset
CapabilityData modification (DML/DDL) Standard SQLINSERT, UPDATE, DELETE, CREATE Workday WQLRead-only; mutations require Workday REST or SOAP APIs

WQL WHERE Equality and Filter Syntax

WQL’s WHERE clause evaluates Boolean expressions using AND, OR, and parentheses ( ) to control precedence (parenthesized expressions evaluate first). Literal formatting depends on the field’s Workday data type:

  • Text fields: wrap string literals in single quotes (WHERE status != 'Terminated').
  • Boolean and numeric fields: leave literals unquoted (WHERE isActive = true, WHERE yearsOfService >= 5).
  • Date fields: convert string dates with TO_DATE (WHERE accounting_Date <= TO_DATE('2026-01-01', 'yyyy-MM-dd')).
  • Empty checks: use is empty or is not empty instead of IS NULL (WHERE terminationDate is empty). Both operators work across Boolean, Date, Instance, Numeric, and Text fields.
  • Substring checks: use contains, not contains, startswith, or endswith instead of LIKE. All four are case-insensitive (WHERE businessTitle contains 'Manager', WHERE businessTitle endswith 'Lead').
  • Workday IDs (WIDs) and Reference IDs: use IN (...) to match instance fields against 32-character hexadecimal WIDs or reference IDs (inst_refId = "referenceID", where the double quotes around the reference ID are optional).

Example 1: Equality, Boolean, and Text Filters

wql
SELECT employeeID, legalName_lastName, businessTitle, hireDate
FROM allWorkers
WHERE isActive = true
  AND (businessTitle contains 'Engineer' OR businessTitle contains 'Architect')
  AND terminationDate is empty
ORDER BY hireDate DESC

Example 2: Filtering by WID or Reference ID (IN)

wql
SELECT worker, employeeID, location
FROM allWorkers
WHERE locationCountry IN (inst_refId = "USA")
  AND location IN ('0c0bbf2e124810a26765415bb08406c5', '4a9f10c3b81210a26765415bb08407d1')

Each WID inside IN (...) must be an individual item. Passing a comma-separated string inside a single pair of quotes (IN ('wid1,wid2')) fails with HTTP 400 Bad Request (Specify a valid value for the field).

WQL replaces SQL JOIN statements with Related Business Object (RBO) traversal. In the SELECT clause, reference fields on a related object by placing the related field inside curly braces {} after the RBO link field, and add a unique AS alias when selecting multiple fields from the same RBO.

To filter rows based on an RBO field (including multi-instance fields such as dependents), place a WHERE ON clause immediately after FROM and before any primary WHERE clause. Omit the curly braces inside WHERE ON.

wql
SELECT
  worker,
  dependents{legalName_FirstName} AS dependentFirstName,
  dependents{age} AS dependentAge
FROM allWorkers
WHERE ON dependents age < 18
WHERE isActive = true

When sending a WQL query in a GET request query string, REST clients that do not automatically encode URLs require { and } to be percent-encoded as %7B and %7D.

Data Source Filters and Prompt Parameters (FROM and PARAMETERS)

Unlike SQL tables, many Workday data sources expose built-in data source filters and prompt parameters that restrict records before the WHERE clause runs. You can pass prompt values either inside the FROM clause parentheses or in a leading PARAMETERS clause, but never in both places in the same query, and each parameter may appear only once.

Example 4: Data Source Filter with Inline Prompt Parameters

wql
SELECT worker, businessTitle, employeeID, hireDate
FROM workersForHCMReporting(
  dataSourceFilter = allActiveWorkers,
  location = ("0c0bbf2e124810a26765415bb08406c5")
)
ORDER BY employeeID ASC

The same query can move the prompt into a PARAMETERS block while keeping dataSourceFilter inside FROM:

wql
PARAMETERS location = ("0c0bbf2e124810a26765415bb08406c5")
SELECT worker, businessTitle, employeeID, hireDate
FROM workersForHCMReporting(dataSourceFilter = allActiveWorkers)
ORDER BY employeeID ASC

Aggregation, GROUP BY, HAVING, and Pagination

WQL supports AVG(), COUNT(), COUNT(DISTINCT field), MAX(), MIN(), and SUM() in SELECT and HAVING. Percentile functions are not supported.

  • GROUP BY restrictions: WQL cannot group by aggregated fields, currency fields, or multi-instance fields.
  • HAVING: requires a GROUP BY clause and filters aggregated groups (for example, HAVING count() > 100).
  • LIMIT vs REST limit and offset: An in-query LIMIT clause accepts an integer from 1 to 999,999, but Workday still evaluates the full result set before truncating it, so LIMIT does not improve backend execution speed. To page through large datasets via /wql/v1/data, use the REST query parameters limit (up to 10,000 rows per page) and offset (0-based starting row). For a full walkthrough of large result pagination, see How to return more than 500 rows in WQL.

For quick syntax lookup across clauses, keep the Workday WQL Cheat Sheet handy.

Common Errors SQL Developers Hit in WQL

  1. Writing SELECT *: WQL rejects wildcard projections. Every column must use its exact Workday WQL field alias; if you do not know an alias, build a quick Custom Report and run the Workday task Convert Report to WQL.
  2. Using IS NULL or LIKE: Replace IS NULL / IS NOT NULL with is empty / is not empty, and replace LIKE with contains, not contains, startswith, or endswith.
  3. Filtering an RBO in the main WHERE clause: Writing WHERE dependents{age} < 18 or WHERE dependents is not empty fails validation (such as can only be used as a related business object field (RBO)). Move RBO filters into WHERE ON <rboAlias> <field> ....
  4. Duplicating prompt parameters across PARAMETERS and FROM: Supply data source filter prompts in one location only, or the query fails validation.
  5. Assuming LIMIT 10 speeds up a slow query: Because WQL computes the full result set before applying LIMIT, always narrow the dataset with an indexed dataSourceFilter or selective WHERE conditions first.
  6. Expecting CASE or subqueries to reshape data: WQL does not evaluate conditional branching or nested queries. Create a Workday calculated field for conditional logic and query that field’s WQL alias, or perform joins and transformations downstream.

Sources checked

Run WQL against your real tenant.

Kiweely Vine inspects your tenant's data sources and fields, runs the query under your Workday security, and verifies the rows returned.

Get the next guide in your inbox.

One email a month with new guides and one Extend tip. Nothing else.

We’ll email you once to confirm. Unsubscribe in one click from any issue.

Protected by reCAPTCHA. Google’s privacy policy and terms apply.