MySQL data reduction

Hi I have started to get year’s of data in my DB. I don’t want to delete it more average it out to 5 minutes - 1hr depending on the age.

Has anyone got a stored procedure or code that does this nicely?

Related:

Sorry should of mentioned I am using MySQL

This is not specifically a openHAB issue. Its ok to ask here however you may get a better response and help on a MySQL forum.