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
dongdong 

Is there a group by , sum(), avg() functions in SOQL ?

Hi  All,
    I want to translate the following SQL into SOQL  , is it possible?  For example:
 
    Table: Test1
     column1      column2   column3
      s1                  90                 4
      s1                  100                5
      s2                   60                 3
      s2                   30                 2
     
SQL :  select  sum(column3),avg(column2) from Test1 group by  column1
 
What the  SOQL is ?  Is there a SOQL  in salesforce?
 
Thank you!!
 
 
 
 
 
 
SuperfellSuperfell
There are no aggregate functions in SOQL.
mba75mba75
 
 
If there no aggreggate function in SOQL how Salesforce create the crosstab report ?
 
Is there any way to reproduce that type of report in a visualforce page or an scontrol ?
 
 
ajaslkfjqpr89q0ajaslkfjqpr89q0

With Winter 2010 there are some new features functions available in SOQL. See below:

 

 

http://www.ext-it.com/2010/blog/soql-group-by-grouping-records-in-salesforce-com.html