Please help me how to write a query to fetch the data of each minutes in one day interval.
For each ten mins the average of the value is calculated
Fetch 10 minutes data
Moderator: General Moderators
Re: Fetch 10 minutes data
rash28 wrote:Please help me how to write a query to fetch the data of ten each minutes in one day interval.
For each ten mins the average of the value is calculated
//I have a Query to fetch the one day interval data.
Now from the above result I should calculate the average of each ten minutes data.
How to proceed with it
How to calculate the average of each timestamp of ten minutes.
$query="select * from tablename where timestamp < now() and timestamp > (now()-interval 1 day) andxpgeek wrote:MySQL can not generate data.
The solutions is to create second table which contain each minute in a row of a day,
when join this two tables and get a result.
timestamp = DATE_SUB('.$timestamp.',INTERVAL '23:50:0' MINUTE_SECOND)";
Suggest me any query which uses time() instead of now().
For each average of ten minutes data to be fetched and average is calculated
select `fieldname` from `tablename` where `timestamp` < time() and timestamp > (time()-interval 1 day)-------
This fetches all the data for 1 day.
From the result a I should calculate the avg value for each ten minutes