Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.