---
cuppy_hub: salesforce
cuppy_path: reference/official/data360/data-cloud-query-guide/guide/subqueries-related-data.md
cuppy_section: docs
cuppy_doc: DAPQ-3GPM
cuppy_doc_uuid: fbbbb33f-d0b9-4f30-bebc-98b0a5010e51
cuppy_permalink: https://cuppy.io/salesforce/d/DAPQ-3GPM
cuppy_version: 1
cuppy_updated: 2026-10-23T16:16:52.575Z
cuppy_canonical: https://cuppy.io/salesforce/docs/reference/official/data360/data-cloud-query-guide/guide/subqueries-related-data
cuppy_mcp: https://cuppy.io/mcp
cuppy_body_sha256: 6cfd52996c930a0344dc3becf46b090a2c22c37682b46e1e5ba3f0bdf8f31d7e
# cuppy_body_sha256 is over the document body ALONE, excluding both generated blocks.
---

> Mirror of <https://developer.salesforce.com/docs/data/data-cloud-query-guide/guide/subqueries-related-data.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.

To check for the presence or absence of related data, use the `EXISTS` or `NOT EXISTS` operators. These operators are part of the `WHERE` clause that precedes a subquery. A subquery is a query that appears inside another query statement.

These query examples all use a subquery to check on related records to accounts.

*   Which accounts don’t have a phone number?
*   Which accounts have a phone number but no email address?
*   How many accounts have a phone number but no email address?

For example, this query uses a subquery to return the accounts that don’t have a phone number.

This output shows the first few rows of the sample results.

| `ssot__Id__c` | `ssot__Name__c` |
| --- | --- |
| 001Hu00002xHZJnIAO | Pyramid Construction Inc. |
| 001Hu00002xHZJtIAO | United Oil & Gas, UK |
| 001Hu00002xHZJuIAO | United Oil & Gas, Singapore |

You can use these predicates with subqueries.

*   `EXISTS`
*   `NOT EXISTS`
*   `IN`


---
<!-- cuppy -->
You are reading one file. The same content is free over MCP at https://cuppy.io/mcp with no signup: ranked search across all 376 documents in this hub, the merged view when you work in a layer, known workarounds matched to the error you hit, and depth control so you spend tokens on what you need. Start with the `_hello` tool. How to connect: https://cuppy.io/salesforce/ Something wrong in this document? Report it with the `session feedback` tool on the same endpoint.
<!-- /cuppy -->
