Newer Version Available

This content describes an older version of this product. View Latest

Comparison Operators

Use comparison operators to compare values of the same type. For example, you can compare strings with strings and numbers with numbers.
Operator Name Description
== Equals Returns True if the operands are equal. String comparisons that use the equals operator are case-sensitive.

For multivalue fields, use in to identify rows that contain some value.

Note

!= Not equals Returns True if the operands aren’t equal.

For multivalue fields, use not in to identify rows that don't contain some value.

Note

< Less than Returns True if the left operand is less than the right operand.
<= Less or equal Returns True if the left operand is less than or equal to the right operand.
> Greater than Returns True if the left operand is greater than the right operand.
>= Greater or equal Returns True if the left operand is greater than or equal to the right operand.
like Like Returns True if the left operand contains the string on the right. Wildcards and regular expressions aren’t supported. This operator is case-sensitive.

To match any single character in the string, include an underscore (_). To match any pattern of zero or more characters include a percent sign (%).

Starting a pattern with a percent sign returns all words that are either the pattern itself or that end with it. Ending a pattern with a percent sign returns all the words that are either the pattern itself or that begin with it. To match a pattern anywhere in a string, the pattern must start and end with a percent sign.

To include a literal percent sign or underscore in a pattern, you must escape them with a backwards slash (\).

This query matches names such as Anita Boyle, Annie Booth, Derek Jernigan, and Hazel Jennings.

This query matches names that end with "ne" or contain "ne." These names include Andrew Levine, Annette Boone, Annette Cline, and Annie Horne.

Use with ! to exclude records. For example, the following query shows all customer names that don’t contain "po."
matches Matches Returns True if the left operand contains the string on the right. Wildcards and regular expressions aren’t supported. This operator isn’t case-sensitive. Single-character matches aren’t supported.
For example, the following query matches airport codes such as LAX, LAS, ALA, and BLA.
Use with ! to exclude records. For example, the following query shows all opportunities where Stage isn’t equal to Closed Lost or Closed Won:
in In Returns True if the left operand contains one or more of the values in the array on the right. For example:
If the left operand is a measure, the query returns True if the left operand is in the array on the right.

Use the date() function to filter by date ranges.

If you search for values in an empty array, in returns False.

Ranges that are out of order evaluate to False. For example, ["Z" .. "A"] evaluates to False.

not in Not in Returns True if the left operand isn’t equal to any of the values in an array on the right.

If you use matches or like with multivalue fields, make sure to use mv_to_string() to match all relevant values. If any of the values in the array satisfies the condition, the query returns the first value. The query returns array values in numerical or alphabetical order. The first value it returns in this case isn’t necessarily the value that satisfied the condition.

Note