View Single Post

   
  #3 (permalink)  
Old 02-28-2008, 10:25 AM
omeldoid@gmail.com
 
Posts: n/a
Default Re: how to count the number of each item per day

ok, i've found the answer. i've compared it against hours, as my test
case doesn't yet have enough days. but here it is, in a simplified
form:

select date_format(date, "%H"), item, count(item)
from mytable
group by item, date_format(date, "%H")

the trick is in using two fields in the `group by' clause!

Reply With Quote