---
schema_version: "1"
id: 945cf6917f03e9d27991441f9513fd4bcf52a239fb4485184deed263ce8d3051
title: Comparison Operators
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-operators-comparison.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-operators-comparison.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2bc324e8eb35ddf8446ea9f2a593c528860a660e7e3276b1892f43bd07b64aec
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# 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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `!=`      | Not equals       | Returns `True` if the operands aren't equal.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `<`       | 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 (`\`). Use with `!` to exclude records. |
| `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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `in`      | In               | Returns `True` if the left operand contains one or more of the values in the array on the right. 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](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-date.md) 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`.                                                                                                                                                                                                                                                                                                                                     |
| `in*`     | In star          | Use in\* to search multivalue fields. Returns `True` for each row that contains every value in an array on the right.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `not in`  | Not in           | Returns `True` if the left operand isn't equal to any of the values in an array on the right.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `not in*` | Not in star      | Use `not in*` with multivalue fields. Returns `True` if the left operand doesn't contain any of the values in the array on the right.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

**Note:** For multivalue fields, use `in` to identify rows that contain some value.

**Note:** For multivalue fields, use `not in` to identify rows that don't contain some value.

This query matches names such as Anita Boyle, Annie Booth, Derek Jernigan, and Hazel Jennings:

```nolang
q = filter q by Customer_Name like "%ni%";
```

This query matches names that end with "ne" or contain "ne." These names include Andrew Levine, Annette Boone, Annette Cline, and Annie Horne:

```nolang
q = filter q by Customer_Name like "%ne";

```

This query shows all customer names that don't contain "po":

```nolang
q = filter q by !(Customer_Name like "%po%");
```

This query matches airport codes such as LAX, LAS, ALA, and BLA:

```nolang
my_matches = filter a by origin matches "LA";
```

Use `!` to exclude records. This query shows all opportunities where Stage isn't equal to Closed Lost or Closed Won:

```nolang
q = filter q by !('Stage' matches "Closed");
```

For example:

```nolang
a1 = filter a by origin in ["ORD", "LAX", "LGA"];
```

**note:** 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.

**See Also**

- [filter](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-statement-filter.md)
- [Multivalue Field](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/concept/bi-saql-multivalue.md)
