Skip to main content
Administrator Guide
Last Updated: 2024-02-09
WHERE

WHERE

Specifies one or more conditional expressions that filter the results of the query. Workday evaluates expressions in parentheses first in conditional expressions. Use the
AND
and
OR
logical operators to separate conditional expressions in Workday Query Language (WQL).

Syntax

WHERE field1 = value1 AND field2 IN (instance1, instance2) OR field3 IN (inst_refId = referenceID)

Arguments

Argument
Description
field1
,
field2
, ...
fieldN
The alias for a field in the conditional expression.
value1
,
value2
, ...
valueN
The value of the field you want to match.
instance1
,
instance2
, ...
instanceN
The Workday ID of the field value you want to match.
When you run a query, Workday validates the format of the Workday ID and fails the query when the format is invalid.
inst_refId
The reference ID type of a field in the conditional expression.
referenceID
The reference ID of the field value you want to match.
You can filter by the reference ID with or without double quotes.
Examples
  • (inst_refId = "referenceID")
  • (inst_refId = referenceID)

Comparison Operators

Operator
Field Data Type Compatibility
Description
=
Boolean
Date
Numeric
Text
Equal.
>
Date
Numeric
Greater than.
>=
Date
Numeric
Greater than or equal to.
<
Date
Numeric
Less than.
<=
Date
Numeric
Less than or equal to.
!=
Boolean
Date
Numeric
Text
Not equal.
contains
Text
The comparison value is a subset of the field value.
Case insensitive.
Example: Cat contains AT.
not contains
Text
The comparison value isn't a subset of the field value.
Case insensitive.
Example: Cat doesn’t contain dog.
endswith
Text
The comparison value is a subset of field value. The last character of the field value matches the last character of the comparison value.
Case insensitive.
Example: Cat ends with AT.
in
Instance
Text
The field matches 1 or more possible values for a condition.
is empty
Boolean
Date
Instance
Numeric
Text
The field has no value.
is not empty
Boolean
Date
Instance
Numeric
Text
The field has a value.
not in
Instance
Text
The field doesn't match any possible values for a condition.
startswith
Text
The comparison value is a subset of the field value. The first character of the field value matches the first character of the comparison value.
Case insensitive.
Example: Cat starts with CA.

Date and Time Formats

WQL supports dates and datetimes in Coordinated Universal Time (UTC) or Pacific Standard Time (PST).
Date and Time
Format
Date
YYYY-MM-DD
Time (24-hour clock)
HH:MM:SS
Datetime with time zone
PST: YYYY-MM-DD HH:MM:SS
UTC: YYYY-MM-DD HH:MM:SSZ

Examples

Return worker and location fields from the
allWorkers
data source where the location is San Francisco and the Workday ID is a specific worker:
SELECT worker, location FROM allWorkers WHERE location in (Location_ID = San_Francisco_site) AND worker in (3895af7993ff4c509cbea2e1817172e0)
Return billable transactions that were approved between 7:15 AM on August 1, 2020 and 7:45 AM on August 30, 2020, using Coordinated Universal Time (UTC) by adding Z to the datetime values:
SELECT billableProject, projectCompany, approvalDate FROM billableProjectTransactions WHERE (approvalDate >= '2020-08-01 07:15:00Z' AND approvalDate <= '2020-08-30 07:45:00Z')

Limitations

WHERE ON clauses must go before WHERE clauses.