simple sql group by custom groups question [migrated]
- by alex
imagine a mysql table that only has 2 columns, an id and a name of a color.
with this query I know how many id's do I have for each color.
SELECT color_name, count(id) FROM color_table GROUP BY (color_name);
red:10
blue:5
yellow:3
green:1
my question is, is there a way I can specify to the "group by" some custom groups??
i mean, is there a query that results in this??:
red:10
colors different than red: 9