Progress
Embedded SQL-92
Guide and Reference


NULL Values in Aggregate Functions

Aggregate functions ignore rows with NULL values in an argument and return the value based on the rest of the rows. You can specify the COUNT function with an expression as the argument.

EXAMPLE

For example, to count all the rows in the employee table, including those with NULL values in the commission column, the SELECT statement is:

EXEC SQL
     SELECT COUNT ( NVL (commission, 0))
     FROM employee ; 

If the column contains only NULL values, the COUNT DISTINCT column_name returns zero and the rest of the aggregate functions return NULL for that column. An exception is when you specify COUNT(*). This returns the number of rows regardless of the column values.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095