I have a MYSQL DB with two columns, one is the temperature and the other one is the time in which the temperatura was read, like http://pastebin.mozilla.org/1860064 .
The temperature USUALLY have a 5minutes difference between reads, but this is not always with this time gap.
What I need to figure out is a algorithm to read all the values and save the average of every hour of read, so temperature will be saved on the db with one temperature per hour, 24 reads per day, and it would save in another db’s table.
For example:

It would save with the average temperature and with the date 2012-10-07 10:00:00,
Was I clear?
Here is one way to do this with just a query. If you need the results stored in the database you’ll need your own inserts but this will get you the data you’re looking for.
You can swap the
2012-10-06part out for whatever date you are looking at.Edit: Here it is updated with your info:
This should do the trick!