Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: SQL for intervals

Re: SQL for intervals

From: Lennart <Erik.Lennart.Jonsson_at_gmail.com>
Date: 2 Dec 2006 08:32:00 -0800
Message-ID: <1165077120.678403.66260@l12g2000cwl.googlegroups.com>

Bob Badour wrote:
[...]
> select id_lwr, min_t as lwr_bound, min(max_t) as upr_bound
> from (
> select id as id_lwr, t as min_t from W W1 where not exists (
> select 1 from W W2 where W1.t = W2.t + 1 and W1.id = W2.id
> )
> ) WL,
> (
> select id as id_upr, t as max_t from W W3 where not exists (
> select 1 from W W4 where W3.t = W4.t - 1 and W3.id = W4.id
> )
> ) WU
> where id_lwr = id_upr and max_t > min_t
> group by id_lwr, min_t
> ;

I think you will have to change the last predicate in order to detect things that only occur one day.

/Lennart

[...] Received on Sat Dec 02 2006 - 10:32:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US