POV-Ray : Newsgroups : povray.off-topic : SQL help : Re: SQL help Server Time
11 Oct 2024 01:21:44 EDT (-0400)
  Re: SQL help  
From: Darren New
Date: 8 Mar 2008 18:00:16
Message: <47d31a80$1@news.povray.org>
Kyle wrote:
> I imagine there are several ways to skin that cat.

Simpler conceptually:

It was something like this. We have a table of data coming in,
different sources providing us with data, and we know the
starttime, but we have to also know how long the data was
valid.  So, roughly, and with the wrong syntax:

create table metadata (
   starttime, duration default null,
   source, information
)

update metadata as y set duration =
   (select min(starttime) from metadata as x
     where y.source = x.source and
           y.starttime < x.starttime)
   where y.duration is null

After that sort of thing ran overnight without finishing,
I said screw it, and wrote a program to go through
the table and do the update programmatically, which
ran in about five minutes or so. With the ability
to tell how far you were finished.

Then, to answer the question Andrew actually was asked, you'd modify it 
to look for or count durations > 10 minutes, rather than storing them in 
the table.  That's what I meant about finding the ends of sessions 
instead of the start.

-- 
   Darren New / San Diego, CA, USA (PST)
     "That's pretty. Where's that?"
          "It's the Age of Channelwood."
     "We should go there on vacation some time."


Post a reply to this message

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