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
vagishvagish 

[select city__c, count(id) from country__c group by city__c];

This query giving invalid token count error.

 

what is the problem here??

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

I've been able to do this from the system log, as saved apex and via unit tests.

 

If you check the meta-xml for the apex class, what version are you on?

All Answers

SfdcBlueFishSfdcBlueFish

vignesh try like this,

 

select id,city__c,count(id) from country group by city__c;

vagishvagish

still it is giving same error!!!

 

bob_buzzardbob_buzzard

That syntax looks correct - I can run a similar query on contacts grouped by firstname without problem.

 

Can you post any more code? 

vagishvagish

I think u r running query on system log, here it works no problem.

But in apex code, it is not working..

bob_buzzardbob_buzzard

I've been able to do this from the system log, as saved apex and via unit tests.

 

If you check the meta-xml for the apex class, what version are you on?

This was selected as the best answer
vagishvagish

thnx bob, I m using older version,  14, now with version 20 I m able to do this.