Can I show all unique values in a column w/# of times each occurs

J

JetFred

Can I summarize a column by listing unique values with a count of how many
times each occurs?
 
T

tina

yes, in a Totals query. open a new query in design view. add the table that
holds the field you want to total (in an Access table, the correct name for
a "column" is "field"). in the query design grid, add the field twice. on
the toolbar, click the Totals button (a funny-looking capital E, or a
capital M lying on its' side). the default setting for each field is "Group
By". in the second field, change the Group By setting to Count.

the SQL statement looks like

SELECT MyTable.MyField, Count(MyTable.MyField) AS CountOfMyField
FROM MyTable
GROUP BY MyTable.MyField;

hth
 
S

Steve Schapel

JetFred,

Yes, you can do this with a Totals Query. Make a query based on your
table. Add the field you want summarised, and another field (probably
the primary key field of the table) to the query design grid. Make it a
Totals Query (select Totals from the View menu). For the field you want
to summarise, leave the setting in the Totals row of the grid as Group
By, and in the Totals row of the other field, enter Count.
 
J

JetFred

Thanks, both of you. It worked perfectly, I guess I never noticed the "sum"
sigma on the toolbar. I knew it would be something simple. I am pretty
clueless in Access. I should've asked here first. The network guys at work
didn't know.
 
S

Steve Schapel

JetFred said:
.... I should've asked here first. The network guys at work
didn't know.

At a rough guess, I would imagine that here rather than the "network
guys" would usually be the best bet ;-)
 
Top