1

This query

SELECT Reason, COUNT(Id) 
FROM Case 
WHERE RecordType.DeveloperName = 'Problem' AND AccountId = 'xxxx' 
AND GROUP BY Reason

is giving me

Unknown parsing error:

But when I run the same query without the RecordType.DeveloperName = 'Problem' it works, whats the issue?

SELECT Reason, COUNT(Id) 
FROM Case 
WHERE AccountId = 'xxxx' AND GROUP BY Reason

Thank you

  • 3
    Are you sure the other query works? You have AND before GROUP BY, that should not work either. – Jayant Das Mar 29 at 16:30
5

Your problem is the last AND.

The right query is:

SELECT Reason, COUNT(Id) 
FROM Case 
WHERE RecordType.DeveloperName = 'Problem' AND AccountId = 'xxxx' 
GROUP BY Reason
  • 1
    Just found it too. Thank you! – BoDiE2003 Mar 29 at 16:30
  • Nice! If it helped, marked the answer as accepted so others can benefit as well – Sebastian Kessel Mar 29 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.