List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:October 25 1999 5:26pm
Subject:Re: Just in case this is possible ...
View as plain text  
At 5:53 PM +0100 10/25/99, Simon Gornall wrote:
>I'm pretty sure there's no way of doing this in one query, but
>just in case ....
>
>Say I have a table
>
>CREATE TABLE test (
>  cron  DATETIME,
>  delay INTEGER);
>
>and in it, every minute, an entry is placed using NOW() for 'cron'
>and a particular value (100->1000) for 'delay'
>
>What I want to get is a time-averaged figure for 'delay', so I see
>the average delay over an hour.
>
>Is there any way of aggregating the 'delay' values over a time-period
>and doing it for all successive time periods in one go ?
>
>Perhaps I should wait until we get correlated sub-queries or stored
>procedures ?

How about using GROUP BY on the cron values with the last three characters
chopped off to drop the seconds part, then use AVG() on the delay values?

-- 
Paul DuBois, paul@stripped
Thread
Just in case this is possible ...Simon Gornall25 Oct
  • Re: Just in case this is possible ...Paul DuBois25 Oct
  • Re: Just in case this is possible ...Stephen J. Taranto25 Oct