> ## Content Index
> Fetch the complete content index at: https://www.namastesalesforce.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# SOQL: accounts with no contacts
- URL: https://www.namastesalesforce.com/snippets/soql-accounts-with-no-contacts/
- Published: 2026-04-27T09:00:00.000Z
- Updated: 2026-04-27T09:00:00.000Z
- Description: The anti-join: records missing children, without a report type gymnastics session.
- Author: Swarnil Singhai
- Tags: #snippet, #snippet-lang-soql, Admin, #Import 2026-09-03 19:13

```sql
SELECT Id, Name, Owner.Name, CreatedDate
FROM Account
WHERE Id NOT IN (SELECT AccountId FROM Contact)
  AND CreatedDate = LAST_N_DAYS:90
ORDER BY CreatedDate DESC
```

The anti-join: records missing children, without a report type gymnastics session.

## Gotchas

NOT IN with a subquery is limited to one level and can be slow on very large orgs — for millions of accounts, run it in batches or flip it into a report with a cross filter.