I am trying to find out of how many Number of location (Account object field) having each account by using below SOQL query.

select name, count(Numberof_locations__C) from account group by Name

Here some of the accounts having number of locations 6, but the query is returning only 1 for all accounts.

How to get accurate results?

1 Answer 1


If your field Numberof_locations__C is a Number field and you want to calculate number of locations, you can use SUM() in your aggregate query.

COUNT() returns the number of rows that match the filtering conditions.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .