First check whether Workday knows the names

A query can look correct and still fail because its data-source or field alias came from a label, another tenant or an old example. Retrieve the source and its fields from Workday, then check that the calling person can see them. WQL follows both the Workday Query Language domain and the ordinary security on the data source and fields.

If Workday does not return a source or field in metadata, do not keep changing punctuation. Resolve the alias or access first, then rerun the smallest query that selects one known field.

Workday error

"Invalid WQL syntax … at or near 'WHERE'"

A filter on a related business object — a WHERE ON clause — sits after the main WHERE, or is joined to it with AND. Workday requires every WHERE ON clause to come before the main WHERE, one clause per related object.

Fails
SELECT worker, dependents{legalName_LastName}
FROM allWorkers
WHERE defaultWeeklyHours > 30
WHERE ON dependents legalName_LastName startswith "N"
Works
SELECT worker, dependents{legalName_LastName}
FROM allWorkers
WHERE ON dependents legalName_LastName startswith "N"
WHERE defaultWeeklyHours > 30
Workday error

"You can't use aggregation functions when the SELECT clause specifies a Related Business Object (RBO) field"

The query mixes a count, sum or average with a field in braces, such as dependents{legalName_LastName}. Workday will not do both in one query. Split it in two: one query for the numbers, one for the related details.

SELECT location, COUNT()
FROM allWorkers
GROUP BY location
Workday error

"To aggregate fields, specify a numeric field type"

AVG or SUM was applied to a field that is not a number, such as a date or a name. Average a numeric field instead. To count people or records, use COUNT(), which takes no field, or COUNT(DISTINCT field) for text and single-instance fields.

SELECT supervisoryOrganization, AVG(age)
FROM allWorkers
GROUP BY supervisoryOrganization
Workday error

"text or date target values must be in single or double quotes"

A text or date value in the filter is not quoted. Quote dates ('2026-01-01') and text, including a Workday ID when you compare it with a text field. Instance fields are different: inside in (…) they take Workday IDs without quotes, and a reference ID works with or without them.

SELECT worker, employeeID, hireDate
FROM allWorkers
WHERE hireDate >= '2026-01-01' AND employeeID != '21001'
Workday warning

"Results will be limited to 500 instances only."

This is a warning, not an error. The View WQL Query Result report stops at 500 rows whenever a query has no limit or a limit above 500. The query itself is fine; getting more than 500 rows from WQL covers how to reach the rest.

SQL habits WQL does not accept

  • There is no LIKE. Use contains, startswith or endswith; all three ignore case.
  • There is no SELECT *. Name each field you need.
  • Greater-than and less-than work on numbers and dates only, not on text such as an employee ID.
  • Braces select fields of a related business object only when Workday has registered one for that field. Check the data source's field list before writing field{…}.
SELECT worker, fullName
FROM allWorkers
WHERE fullName startswith "Mar"

Build and verify the query from the beginning

If the problem is larger than one error message, use the Workday WQL guide to discover the source, choose an execution route and verify the returned population. For a result stopped by the tenant report, see getting more than 500 rows from WQL.

Sources checked