What are example expression for counting specific records in a fi.

S

Skip

What are example expression(s) for counting specific records in a field? I
know this a simple task but, I've spent about an hour trying to accomplish!

Thanks
 
D

Douglas J Steele

Not quite sure what you're looking for.

If you've got a field that has the following values:

Blue
Red
Blue
Blue
Green
Red

do you want something like:

Blue 3
Green 1
Red 2

If so, you can write an Aggregate query to do that. The SQL would be
something like:

SELECT MyField, Count(*) As TotalNumber
FROM MyTable
GROUP BY MyField

To do this through the query builder, you'd drag "MyField" and another field
(one that you know is never Null) into the grid. Change the query into a
Totals query (by clicking on the Sigma icon on the button bar, or selecting
View | Totals from the menu bar). That will introduce a new row in the grid
labelled "Total". Leave the "Group By" under the "MyField" field, and change
"Group By" to "Count" under the other field.
 
Top