+ 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