dz_boy
01-02-2010, 06:29 PM
I have a database table that is a list of items. It has columns for id, type_id, date, staff_id, memo, etc. I'm trying to select the number of items (i.e. using the count() function) of each type per person. So the output table would be like:
Name: | Count of Type 1: | Count of Type 2 | .......
--------------------------------------------------------------------
Chris | 3 | 2 |
John | 2 | 1 |
Any ideas? I think it's a matter of counting the items based on type_id and then grouping them by staff_id, but I can't seem to get it.
Any help is appreciated! Thanks.
Name: | Count of Type 1: | Count of Type 2 | .......
--------------------------------------------------------------------
Chris | 3 | 2 |
John | 2 | 1 |
Any ideas? I think it's a matter of counting the items based on type_id and then grouping them by staff_id, but I can't seem to get it.
Any help is appreciated! Thanks.