Subquery Comparisons

Data 360 Query Guide, mirrored from developer.salesforce.com: **Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

markdownreferencev11APS-70PMguide: data-cloud-query-guidestage: referencetrust: officialsource: developer.salesforce.comservice: data360interface: sqlSubquery ComparisonsData 360Data CloudData 360 Query Guide

Created 23 Oct 2026 · Modified 23 Oct 2026 · 1 version

Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/subquery-comparison.html> (Salesforce, Data 360 Query Guide), read 2026-10-23. Salesforce's own page is the authority; this copy exists because that site refuses non-browser readers.

Subquery Comparisons

Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API

Subquery comparison expressions are SQL-compliant expressions that compare a value or condition against the rows returned by a subquery. All of the expression forms in this section return boolean results.

  • Except for EXISTS, each subquery must return exactly one column.
  • NULL values in a subquery can cause a comparison to return NULL instead of TRUE or FALSE. To avoid unexpected results, filter out NULL values in your subquery (for example, WHERE column IS NOT NULL) when using ALL or NOT IN.

Check whether a subquery returns any rows:

  • EXISTS — Return true if the subquery returns at least one row.

Compare a value against the set of values returned by a subquery:

  • IN — Return true if the value equals any subquery row.
  • NOT IN — Return true if the value equals none of the subquery rows.

Apply a comparison operator across the rows returned by a subquery:

  • ALL — Return true if the comparison holds for every subquery row.
  • ANY / SOME — Return true if the comparison holds for any subquery row.

Read this document as markdown — the same bytes an agent receives.