Question : Need MySQL query help

I have a MySQL table with a code (representing different events), and a datetime field.  I would like to count the number of times that code=11 happens each hour (over many days), but I only want to count 1 event for each hour on any given day.

In other words, how many times (over the lifetime of the data) did at least one code=11 happen during each of the 24 hours.  Count 1 for a specific hour (no matter how many times code=11 appears that hour), but count 1 again when code=11 for that same specific hour on a different day.

In still other words, on how many days did code=11 happen during hour 00, 01, 02, ... 24?

Answer : Need MySQL query help

Random Solutions  
 
programming4us programming4us