Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Sorting multiple rows
"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