Previous Topic: SubstringNext Topic: Tangent


Sum

The sum function returns the sum of the specified numeric column with the same GROUP BY value.

Syntax:

►►─┬─ SUM ─────┬─ (value) ────────────────────────────────────────────────────►◄
   ├─ TOTAL ───┤
   └─ TOT ─────┘

Invocation names:

SUM   TOTAL
      TOT

Parameters:

(value)

Specifies the column or columns to be totaled.

Example:

In this example, you want to find out the total amount of money being spent on salaries in each department:

select sum(salary-amount-0420) as 'total salaries'
 from emposition
                                 EMPOSITION REPORT
                                     09/22/96

                                  TOTAL SALARIES

                                          3187500.00
      END OF REPORT