[thelist] counting frequency of distinct values in MSSQL

Joel D Canfield joel at spinhead.com
Sat Sep 13 14:31:06 CDT 2003


> Joel D Canfield wrote:
> 
> > I need to count the 
> > frequency of each unique numerical value in a table.
> 
> You need to use group by:
> 
> select column, count(column) from table group by column;

Bingo! Thanks, Simon

Josh:

> > How about COUNT(DISTINCT blah)

only returns the number of distinct values, not the number of *EACH*
distinct value; thanks, though

spinhead


More information about the thelist mailing list