Re: tricky SQL query (currently handled through PL/SQL)

From: bung ho <bung_ho_at_hotmail.com>
Date: 5 Jun 2003 14:26:18 -0700
Message-ID: <567a1b1.0306051326.58c41fe9_at_posting.google.com>


jetlag11235_at_yahoo.com (Jetlag) wrote in message news:<2eeed00e.0306050816.72d6beb1_at_posting.google.com>...

>
> This should become the following in my_table_v2:
>
> 1 '01/01/03 00:00:00' '01/01/03 00:00:04' 1
> 1 '01/01/03 00:00:05' '01/01/03 00:00:05' 3
> 1 '01/01/03 00:00:09' '01/01/03 00:00:15' 2
>
> Currently I do this through PL/SQL. This involves creating a cursor
> (see below) and then looping through it. I was wondering if any SQL
> gurus could think of a (more efficient) way to do this without using
> PL/SQL.
>
> SELECT my_name,
> my_date,
> my_code,
> FROM my_table_v1
> ORDER BY my_name, my_date;
>
> Thanks for any help.
>
> -- jetlag --

if i understand correctly, i think this is just a matter of selecting my_name, my_code, min(my_date), max(my_date) and grouping by my_name, my_code. although i'm not sure what you mean by 'adjacent' as i don't see how :01 is 'adjacent' to :04, etc. Received on Thu Jun 05 2003 - 23:26:18 CEST

Original text of this message