Your query suffers from using a (mis)feature of MySQL called hidden columns. The query is choosing arbitrary values for Record_id, Datalog_id, and Time, because these are not mentioned in the group by
clause.
If I speculate that the intended query is:
SELECT Record_ID, Datalog_ID, hour(TIME), AVG( Value )
FROM `Datalog_Values`
WHERE Datalog_ID = '241' AND TIME BETWEEN '2012-06-01' AND '2012-06-30'
GROUP BY Record_id, Datalog_id, hour(TimE )
Then this starts to make sense, assuming that the goal of the query is to produce results for each Record_Id and hour of the day for the given DataLog_id. Do you want results for each hour of the day or each hour of the month?
If you provide sample data and explain the output you want, then your question can be better answered.