How to split records per hour in order to display them as a chart?

Posted by Axel on Stack Overflow See other posts from Stack Overflow or by Axel
Published on 2010-04-20T18:06:06Z Indexed on 2010/04/20 20:03 UTC
Read the original article Hit count: 214

Filed under:
|
|

Hi, I have an SQL table like this : sales(product,timestamp) I want to display a chart using Open Flash Chart but i don't know how to get the total sales per hour within the last 12 hours. ( the timestamp column is the sale date )

By example i will end up with an array like this : array(12,5,8,6,10,35,7,23,4,5,2,16) every number is the total sales in each hour.

Note: i want to use php or only mysql for this.

Thanks

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql