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

From: tom <tomoyoshi_kikuchi_jpn_at_yahoo.co.jp>
Date: 12 Jun 2003 01:46:09 -0700
Message-ID: <da820901.0306120046.30ac571_at_posting.google.com>


jetlag11235_at_yahoo.com (Jetlag) wrote in message news:<2eeed00e.0306111351.149538f6_at_posting.google.com>...
> Ahh, I see where my example could lead to some confusion. An
> augmented example is included below. Note the re-occurrance of the
> value 1 for my_code. There are now two records in the output table
> with this value, and this is why a simple "group by" statement will
> not suffice. Apologies for the confusion.
>
> For example, consider this (new) example data in my_table_v1:
>
> 1 '01/01/03 00:00:00' 1
> 1 '01/01/03 00:00:01' 1
> 1 '01/01/03 00:00:04' 1
> 1 '01/01/03 00:00:05' 3
> 1 '01/01/03 00:00:09' 2
> 1 '01/01/03 00:00:15' 2
> 1 '01/01/03 00:00:20' 1
> 1 '01/01/03 00:00:24' 1
>
> 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
> 1 '01/01/03 00:00:20' '01/01/03 00:00:24' 1
>
> -- jetlag --

In this case, you have to use PL/SQL,I think.

--Tom-- Received on Thu Jun 12 2003 - 10:46:09 CEST

Original text of this message