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
CyclebiffCyclebiff 

Easy SOQL question -- please help!!!!

Hello!

 

I have this basic query example that I'm using with Crystal (this issue is not crystal-specific, only SOQL):

 

 

SELECT Name, (SELECT Name, Title, Phone, Email from Contacts) from Account Where ????????? ORDER BY Name

 

 

It currently returns all records from our entire database. I want this query limit where "a case exists on the account by a specific user" (we use CRM/Cases). The purpose of the report is to see which Agencies an employee has worked with (via Case.Owner.Name).

 

A simple example will suffice!!!! :) And thanks in advance!!!!

SuperfellSuperfell

Something like

 

SELECT Name, (SELECT Name, Title, Phone, Email from Contacts) from Account Where Id in (select accountId from case where ownerId='005.....') ORDER BY Name