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

From: Jusung Yang <JusungYang_at_yahoo.com>
Date: 11 Jun 2003 21:39:04 -0700
Message-ID: <130ba93a.0306112039.1727462b_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 --

Remember one thing, without a "order by" clause the orader of the data you get from the table is not gauaranteed. So, this data does not make sense

> 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

why is it not
> 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:20' 1
> 1 '01/01/03 00:00:24' 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

?

  • Jusung Yang
Received on Thu Jun 12 2003 - 06:39:04 CEST

Original text of this message