POV-Ray : Newsgroups : povray.off-topic : SQL help : Re: SQL help Server Time
11 Oct 2024 01:24:58 EDT (-0400)
  Re: SQL help  
From: Gail Shaw
Date: 7 Mar 2008 16:01:00
Message: <47d1ad0c@news.povray.org>
"Orchid XP v7" <voi### [at] devnull> wrote in message
news:47d19c72$1@news.povray.org...
> Darren New wrote:
> > Or, to clarify. Count the number of sessions that *ended*.  Much easier
> > than counting the number of sessions that started.  Finding the end of a
> > session is finding the row where there's no row with a greater timestamp
> > but within 10 minutes of this timestamp.
>
> Care to write an SQL statement? ;-)

Very rough and probably wrong. It's late and I'm not going to test this

SELECT Stuff FROM someTable a
WHERE not exists
 (SELECT 1 FROM SomeTable b where DATEDIFF ('mi',a.timestamp,b.timestamp)
between 0 and 10 AND a.UserID = b.UserID and a.HitID != b.HitID)

That should give all hits that don't have another hit with the same user ID
in the next 10 minutes.

It's not particuarly efficient, but I don't care right now.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.