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: Ranga Chakravarthi <ranga_at_cfl.rr.com>
Date: Thu, 10 Jan 2002 03:04:14 GMT
Message-ID: <Ow7%7.291579$oj3.57391146@typhoon.tampabay.rr.com>


Ryan,

from the two lines of your example data, you have

12: 2 entries
34: 2 entries
06: 2 entries
56: 1 entries
33: 1 entries

and so on.

If this is what you want, try this query:

select column_value, sum(entries) toatl_entries from
(
select col2 column_value, count(1) entries from <table name>
group by col2
UNION ALL
select col3, count(1)
from <table name>
group by col3
UNION ALL

.
.
.

)
group by column_value
/
HTH,
Ranga Chakravarthi

"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
>
>
>
>
>
Received on Wed Jan 09 2002 - 21:04:14 CST

Original text of this message

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