View Full Version : Count of Field


NeoFax
01-31-2002, 04:58 AM
I need to count how many of each product are in a field automatically and then update a field designating if there is only one. i.e.
product Single
A 0
A 0
B 1
C 0
C 0

I have tried doing this by Single: Iif((Count[product]=1),"1","0"). However, this says something about field c not included in aggregate function. How can I fix this? Or, is it possible? Thanks for any help.

NeoFax

Pat Hartman
01-31-2002, 05:13 AM
I'm not sure if I understood your question but the following query will give you counts of each product. You should not be storing information that can be calculated.

Select Product, Count(*) as ProdCount
From YourTable
Group By Product;

Will produce
A 2
B 1
C 2
based on your list. You can then use this query to look for the products with a count of 1.