user404709 user404709 - 1 year ago 79
MySQL Question

MySQL: hourly average value

I have a table with a 'timestamp' column and a 'value' column where the values are roughly 3 seconds apart.

I'm trying to return a table that has daily average values.

So, something like this is what i'm looking for.

| timestamp | average |

| 2010-06-02 | 456.6 |

| 2010-06-03 | 589.4 |

| 2010-06-04 | 268.5 |


Any help on this would be greatly appreciated.

Answer Source
SELECT DATE(timestamp), AVG(value)
FROM table
GROUP BY DATE(timestamp)

Since you want the day instead of each timestamp

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download