0

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

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.

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.