Snippet
SOQL
27 Apr 2026
SOQL: accounts with no contacts
The anti-join: records missing children, without a report type gymnastics session.
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 DESCThe 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.