DB2 graphic  QMF Version 8

COUNT. -- Count the number of values in a column

The COUNT. column function finds the number of unique values in a column. Specify COUNT. either in an unnamed column or in a target table. You can abbreviate COUNT. as CNT.

The following query finds the average salary of each department for those departments with more than four members.

When you run this query:

Q.STAFF | DEPT | ID  | SALARY |            |
--------+------+-----+--------+------------|
        | G.P. | _ID |  _S    | P. AVG._S  |
 
 
| CONDITIONS    |
|---------------|
| COUNT._ID > 4 |

QMF produces this report:

  DEPT       AVG SALARY
------  ---------------
    38  15457.110000000
    51  17218.160000000
    66  17215.240000000

COUNT. can count values in columns of any data type. For example, by adding a search condition, you can determine the number of employees with a salary in a given range or the number of employees at a given location.

Rules for COUNT.


Go to the previous page Go to the next page

Downloads | Library | Support | Support Policy | Terms of use | Feedback
Copyright IBM Corporation 1982,2004 Copyright IBM Corporation 1982, 2004
timestamp Last updated: March, 2004