+ 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