I want to retrieve all the contacts that have an account with soql query How do i find them Please find below query:

Select accountid from contact where accountid in select id from account

You can try below query :

[Select accountid from contact where accountid != null];

Above query will fetch all contacts which have an account associated with it. Make sure you limit the number of rows fetched.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.