I'm sure this is simple for database experts, but I am just a novice user.

I want to count the FREQUENCY of the color occurrences in my database. Basically, col ID is unique, num is my object, color is the color of each object, and str is a string I've collected for each one. What I want to do is write a MySQL query which can run in PHP to count the occurrences of each color, tallying only once for each object.

So if I have this:

Code:

id    num    color    str
0    1      1        a
1    1      1        sdf
2    1      1        sdfsd
3    1      1        asd
4    2      2        fd
5    2      2        dsss
6    3      1        dsdew
7    4      2        ds
8    4      2        ccd
9    5      1        css
I want to have the output:
Color 1: 3
Color 2: 2

Since there are 3 objects which have color 1 and 2 which have color 2.

Please, could someone help my write my query?