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


Is there a Sum function is SOQL?


I read in some other boards that it is not available, but those were posts of last year...Just was wondering if anything changed...


I know group by doesnt work, but im just asking about a straight sum of 1 column, like :


Select Sum(col1) from Invoices__c


(Im making the call from APEX...if that changes anything....)




Not yet, but the Spring '10 release notes in Prerelease (as of this writing) note that aggregate functions will be available in SOQL as of the Spring '10 release in February 2010.  So when Spring '10 is out, search the API docs for "aggregate functions" to find SUM and other such items.


The only aggregate-ish function that had been available up to Spring '10 was COUNT.

Thank you....glad its finally coming....kinda a pain to code right now :)