+ Start a Discussion
Timothy SmithTimothy Smith 

SOQL with two WHERE clauses help

Help with syntax for 2 WHERE Clauses please.
 
List<AggregateResult> AggregateResultList = [SELECT AccountId, Account.Name name, COUNT(Id) co,  Milestone1_Project__c.id,
                                    Milestone1_Project__c.Implementation_status__c, Milestone1_Project__c.Client_Advisor_Email__c
                                    FROM Case
                                    WHERE CreatedDate = LAST_N_DAYS:5 AND Id IN :Trigger.New
                                    GROUP BY AccountId, Account.Name
                                    HAVING COUNT(Id)  >= 8
                                    ];

 
Danish HodaDanish Hoda
Replace Milestone1_Project__c.Client_Advisor_Email__c with Milestone1_Project__r.Client_Advisor_Email__c
Sanvee MeharaSanvee Mehara
do you still have issue?
Timothy SmithTimothy Smith
Thank you for responding.  Yes, even after changing to Milestone1_Project__r.Client_Advisor_Email__c,  I am having same issue.    Error message below.
ERROR at Row:1:Column:53                                       
                                                               Didn't understand relationship 'Milestone1_Project__r' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. (2:49)