Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a table which contains a column with different items which i would like to count by there type. For example the table looks like the following:

Id |  Type
1  | Table
2  | Table
3  | TV
4  | TV
5  | Table
6  | TV
7  | TV

The result should looks like:

Type  | NumOfItems
Table | 3
TV    | 4

I use the following code which doesn't work for my Access 2003:

SELECT Table1.Type, Count(Table1.Type) AS NumOfItems
FROM Table1
share|improve this question
up vote 0 down vote accepted

You need to add GROUP BY Table1.Type to the end of the query.

share|improve this answer
Thanks! this has helped! Maybe you also know how to add the TOTAL line in the output table? Would be very thankful. – Anna Jun 25 '12 at 3:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.