For a smart metering application i would like to aggregate counter data every hour.
For this a query like 'select sum(value) as GasCounter from data where channel_id=8' gives the actual counter value.
For another display task i need this as data of channel 25 every hour in the same table 'data'. Therefor i have to add a dataset and put a valid unix-timestamp in the field 'timestamp' and the sum value in the field 'value'.
All this must be done every hour.
Can Mysql do all that just by using a routine?
What is the right routine sql? How do i create the routine? How is the trigger done so that the routine is executed everx hour?
I need your help on this!
Thank you!