dbTalk Databases Forums  

how can I count enum values

comp.databases.mysql comp.databases.mysql


Discuss how can I count enum values in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rbaba99@caramail.com
 
Posts: n/a

Default how can I count enum values - 09-27-2006 , 06:11 AM






I have a table like this:

id car state regdate
===========================
1 toyota good 2006-04-01
2 toyota good 2006-04-05
3 ford bad 2006-05-25
.....

the state column is ENUM ('good','bad','very bad')

given a car name (lets say toyota), I want a query that returns the
number of 'good', 'bad' and 'very bad' cars registered for each month
like this:

month good bad very bad
april 2006 2 0 0
may 2006 1 1 2
.....

How can I do that?


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.