Previous Topic: SQL COUNT QueryNext Topic: Dialog


DQL COUNT Query

If all you need is a count of something, using a COUNT statement is much faster than FIND, since no rows are retrieved. CA Dataquery simply executes the query and displays a message about the number of rows found. A simple query with a COUNT statement looks like this:

 COUNT SALES-HISTORY

A complex query with a COUNT statement looks like this:

 COUNT SALES-HISTORY
  WITH REP-ID = G007
   AND ORD-AMT > 1000.00
  RELATED BY ORD-ID TO ORDERS-HISTORY

By adding a WITH clause and a RELATED BY clause, you say you want to know how many rows exist in the SALES table and the ORDERS table where the salesperson G007 sold more than $1000.00.

Note: For more information about COUNT, see the CA Dataquery Reference Guide.