|
|
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
|
|