function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Chad CoffeyChad Coffey 

SOQL to find Accounts without Contacts AND Opportunities

I am looking for help to run a Join Query to find all out Accounts in our Database without Contacts AND Opportuntiy.  I can run the query indepetly, but I would like to join the queries. 

The Query I am runing to find Accounts without Contacts: Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Contacts)
Query to find Accounts without Opportunties: Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Opportunity)
Best Answer chosen by Chad Coffey
LBKLBK
Here it is.
 
Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Opportunity) AND Id NOT IN (SELECT AccountId FROM Contact)

 

All Answers

LBKLBK
Here it is.
 
Select Id, Name From Account Where Id NOT IN (SELECT AccountId FROM Opportunity) AND Id NOT IN (SELECT AccountId FROM Contact)

 
This was selected as the best answer
dddw ggdddw gg
Website Design in Ethiopia (https://shegertech.com/)
amit kumar 2252amit kumar 2252
That's Nice Sound!! 
Best Interesting Two Line Thoughts https://www.agreewords.com/
Basant Panchami Images 2020 https://www.agreewords.com/basant-panchami-images/
Best Good Thought in Hindi https://www.agreewords.com/good-thought-in-hindi/
Best Shayari On Life