function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
Hello Please find the Below Query
As you requested for query which will return the list of account so you should store it in the list of account varibale.List<Account> accountList = [select Id,Name, (select FirstName,LastName from Contacts) from Account WHERE Name LIKE 'hp%'];
if it helps you
Please mark it as best answer...
Thanks
List<Account> Account_List = [select Id,Name,(select FirstName,LastName from Contacts) from Account WHERE Name LIKE 'hp%'];
for(Account ac: Account_List) { String str = ac.contacts.FirstName; String str1 = ac.contacts.LastName }
Please use the below query
Select Id,Name, (Select FirstName,LastName from Contacts) from Account WHERE Name LIKE 'hp%'
Please mark it as best answer...
Thanks,
SalesforceLearner
Hello Please find the Below Query
As you requested for query which will return the list of account so you should store it in the list of account varibale.
List<Account> accountList = [select Id,Name, (select FirstName,LastName from Contacts) from Account WHERE Name LIKE 'hp%'];
if it helps you
Please mark it as best answer...
Thanks
* Well you need to use nested query if you want to get data of two sObject.
* The SOQL query to retrieve data will be like this:
* Now contact is also connected to account object and you can retrieve data of contact like:
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Ajay Dubedi
www.ajaydubedi.com
Use the following SOQL query.
List<Account> account_List = [SELECT Id, Name,(SELECT FirstName,LastName FROM Contacts) FROM Account WHERE Name LIKE 'hp%'];
'%' sign means that any word can come after 'hp'.
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com