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
Rajiv KocherlaRajiv Kocherla 

Issue with complex fetching

1. write a soql query to fetch all users whose role is Manager;
2. write a query to fetch all the accounts which are owned by the users whose role is Manager;
AbhishekAbhishek (Salesforce Developers) 
You can easily get profile information from the user object. Each user has its own profile.that should be a mandatory field as well.

Execute the below query in Query Editor
 
 select id,name,profile.name from user where profile.name='XYZ'


I hope this SOQL will help.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.