You need to sign in to do that
Don't have an account?
SV M
How to query specific number of Contacts related to Account
Hi,
I have a requirement where I need to display only 2 Contacts related to each Account in a list view. Can someone help me how to build the query for my requirement...
Thanks in Advance...
I have a requirement where I need to display only 2 Contacts related to each Account in a list view. Can someone help me how to build the query for my requirement...
Thanks in Advance...
Select Id,Name,(Select Id from Contact limit 2) from Account
You may need to add necessary fields and filters as per your need.
The query you gave was throwing an error says "Didn't understand relation between Account and Contact". Tried solving it but no luck. Can you help me on this...
Select Id,Name,(Select Id from Contacts limit 2) from Account
List<Account> accountList = [Select Id,Name,(Select Id from Contacts limit 2) from Account];