Fetch 10 minutes data

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Fetch 10 minutes data

Post 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
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Re: Fetch 10 minutes data

Post 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.
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Post 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.
rash28
Forum Commoner
Posts: 38
Joined: Wed Aug 01, 2007 1:21 am

Post 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
Post Reply