Page 1 of 1
Fetch 10 minutes data
Posted: Fri Sep 14, 2007 2:34 am
by rash28
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
Re: Fetch 10 minutes data
Posted: Fri Sep 14, 2007 3:21 am
by rash28
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.
Posted: Fri Sep 14, 2007 3:43 am
by xpgeek
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.
Posted: Fri Sep 14, 2007 3:54 am
by rash28
xpgeek 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.
$query="select * from tablename where timestamp < now() and timestamp > (now()-interval 1 day) and
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