List:General Discussion« Previous MessageNext Message »
From:Jigal van Hemert Date:June 29 2004 7:29am
Subject:Re: SQL challenge
View as plain text  
> 1. The average TIME ELAPSED between consecutive REPEATED instances of the
> rowID (GROUP BY rowID, I assume) between one month ago and now.

The easiest solution (if not the only) would be to handle this client side.

If you sort the records by their timestamp you can easily keep track of the
time between them and later on calculate the average interval.
The problem here is that you do not want statistics on individual records,
but you want statistics on data you calculate from two different records.
You could do a self join to combine records of the same table, but to
exclude the combination between row 1 and 3 is not trivial IMHO.

The client script can easily handle these things, since it receives the
records sequentially and so it can easily calculate differences between two
neighbouring records.

Regards, Jigal.

SQL challengeJohn Mistler28 Jun
  • Re: SQL challengeMartijn Tonies28 Jun
  • Re: SQL challengeJigal van Hemert28 Jun
  • Re: SQL challengeRoger Baklund28 Jun
    • Re: SQL challengeJohn Mistler28 Jun
      • Re: SQL challengeJigal van Hemert29 Jun
Re: SQL challengeSGreen29 Jun