0% found this document useful (0 votes)
4 views1 page

Soql Queries

Uploaded by

Hemanth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Soql Queries

Uploaded by

Hemanth Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Related Contacts of All Accounts

Child to parent :-
1.SELECT Name,Account.Type,Account.Id from
Contact WHERE Account.Id!= null

Interview Queries :-
---------------------
This query will give you accounts that DO NOT have any contacts and Opportunities.
-----------------------------------------------------------------------
1.Select Id, Name from Account where ID NOT IN (Select AccountId from Contact) AND
ID NOT IN (Select AccountId from Opportunity)

On the flip, you can query all Accounts that do have at least 1 contact like this
-----------------------------------------------------------------------------------

2.Select Id, Name From Account Where Id IN (Select AccountId From Contact)

3.SELECT Account.Owner.Profile.CreatedBy.Name FROM Contact

4.SELECT Id, Name, Industry, AnnualRevenue,


( SELECT Name, Email, BirthDate FROM Contacts )
FROM Account

5.SELECT Id, Name,


( SELECT Name, Email FROM Contacts), ( SELECT Name FROM Opportunities)
FROM Account where ID IN (Select AccountId from Contact) AND ID IN (Select
AccountId from Opportunity)
6.

You might also like