Mysql query: count and distinct
- by Azevedo
I have this hypotetical MySQL table:
TABLE cars: (year, color, brand)
How do I count # of cars grouped by brand and year? I mean, how can I get to know how many colors are there grouped by brand like:
brand "GM": total # of colors: 8.
brand "GM": total # of years (grouped together): 14 (meaning there are count of 14 different years).
brand…