I am running an apex test and getting the following error:
System.QueryException: unexpected token: results
What I do not understand is that I am running this query in another one of my classes and it works perfectly. The only difference is that this query includes a group by clause. Not sure why the grouping would initiate this error? Is this because I am using a group by within a dynamic soql call?
String contactsWorked_lastWeek = 'SELECT count(id) results, account.SDR_Owner__c SDR results from contact where LastActivityDate = last_week AND account.RecordTypeid != \'0126A000000ytERQAY\' group by account.SDR_Owner__c';
lastWeek_queries.add(contactsWorked_lastWeek);
List<AggregateResult> contactsWorked_lastWeek = Database.query(queries[0]);
VS
String contactsWorked_lastWeek = 'select count(id) results from contact where LastActivityDate = last_week AND account.RecordTypeid != \'0126A000000ytERQAY\'';
lastWeek_queries.add(contactsWorked_lastWeek);
List<AggregateResult> contactsWorked_lastWeek = Database.query(queries[0]);