POV-Ray : Newsgroups : povray.off-topic : Dr POV-Ray : Re: Dr SQL Server Time
6 Sep 2024 11:17:52 EDT (-0400)
  Re: Dr SQL  
From: Darren New
Date: 23 Feb 2009 11:55:21
Message: <49a2d4f9$1@news.povray.org>
scott wrote:
>> OK, here we go. Using a sub-select, you can find the "previous" event 
>> in the log something like this:
>>
>>   SELECT *
>>   FROM EventLog X, EventLog Y
>>   WHERE
>>     X.ExperimentID = Y.ExperimentID AND
>>     Y.Timestamp =
>>     (
>>       SELECT MAX(Timestamp)
>>       FROM EventLog Z
>>       WHERE
>>       Z.ExperimentID = X.ExperimentID AND
>>       Z.Timestamp < X.Timestamp
>>     )
> 
> <snip>
> 
>> ...if that makes *any* sense at all?

I'm guessing that's higher overhead than taking your original 
multi-AND-clause query and adding
   AND NOT EXISTS (Select ...)
to exclude having other records in the range of interest. Of course, it 
depends on your index configuration and how good your optimizer is.

-- 
   Darren New, San Diego CA, USA (PST)
   My fortune cookie said, "You will soon be
   unable to read this, even at arm's length."


Post a reply to this message

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