Getting a count of different fields

  • Thread starter Thread starter Mr. T.
  • Start date Start date
M

Mr. T.

Hi,

i have a table with records that are in a category. For
example the categories are Company, University, Other. I
have several hundreds of records in the table, and now i
need a report that says to me there were n records in the
category Company, n in the category University and n in
the category Other.

Can anyone give me a clue on how to start doing this?

Regards,

Thomas L.
 
Mr. T,

The first thing you need to do is create a query that will count those
records by Category. You will need to use a Grouping. Here is a sample of
some code that may help get you started.

SELECT MyTable.Category, Count(*) AS CategoryTotal
FROM MyTable
GROUP BY MyTable.Category

To use the above in the design view of a new query, click View on the query
design menu, then select View SQL. Paste the above in the space provided
and edit where necessary to supply the correct name for your table and
fields.

hth,
 
Back
Top