Re: Counting groups?
Posted in 1993
dbm@csd4.csd.uwm.edu (Dennis B Meilicke) writes:
>
> How do I count the number of groups returned by a SELECT with a GROUP
> BY clause? SELECT COUNT(*) .... GROUP BY ... will return the number
> of rows in each group. But I want to know the number of groups.
>
> In Oracle, you would use SELECT COUNT( COUNT(*) ) ... GROUP BY ...
Try,
select count( unique field_name ) from table_name;
This should work with most versions of Informix.
Regards - Lester
#############################################################################
# Lester Knutsen lester@access.digex.net #
# Advanced DataTools Corporation Voice: 703-256-0267 #
# Providing Informix Database Tools and Consulting #
#############################################################################