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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting multiple rows

Re: Sorting multiple rows

From: Ed prochak <ed.prochak_at_alltel.com>
Date: 14 Jan 2002 10:04:59 -0800
Message-ID: <e51b160.0201141004.52cb3e97@posting.google.com>


"Ryn" <matty91_at_bellsouth.net> wrote in message news:<k46%7.265616$BX4.15157563_at_e3500-atl1.usenetserver.com>...
> Hello folks,
>
> I have hundreds of rows of data in a format simialr to:
>
> column 1 - column 7
> 2001-12-05, 12, 34, 06, 56, 33, 98
> 1999-09-03, 01, 06, 34, 57, 23, 12
> .
> .
> .
> I need to select column 2 - column 7 and print something similar to:
>
> 12: 6 entries
> 34: 3 entries
> 23: 2 entries
> 01: 2 entries
> 08: 1 entries
> 55: 1 entries
>
> I have been parsing through the SQL documentation and cannot find an
> example that does something similar. Does anyone have an example they
> could share?
>
> Thanks,
>
> - Ryan

Have you considered normalizing this table?

i.e., instead of a table with seven columns:

    datestamp,value1,value2,value3,value4,value5,value6

you have a table with two columns:

    datestamp,value
(there will be 6times more rows than your table but it will be easier to do your counts).

If the order of the values is important use three columns

    datestamp,sequence_nmbr,value

This is good database design practice.

HTH,
  Ed Received on Mon Jan 14 2002 - 12:04:59 CST

Original text of this message

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