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

Home -> Community -> Usenet -> c.d.o.server -> Re: Frequency Count

Re: Frequency Count

From: Bertie Brink <bhb_at_donotspammailme.com>
Date: Fri, 04 Aug 2006 15:17:12 -0400
Message-ID: <12d77q044qdjj35@news.supernews.com>


fitzjarrell_at_cox.net wrote:

>
> SQL> select prod1, count(prod1) over (partition by prod1) freq1,
> 2 prod2, count(prod2) over (partition by prod2) freq2,
> 3 prod3, count(prod3) over (partition by prod3) freq3
> 4 from myprods;
>
> PROD1 FREQ1 PROD2 FREQ2 PROD3 FREQ3
> ---------- ---------- ---------- ---------- ---------- ----------
> 23 1 22 3 45 3
> 34 2 23 1 45 3
> 34 2 22 3 34 2
> 45 1 22 3 34 2
> 54 1 44 1 45 3
>

Excellent! This is the most efficient I have found. Thank you for the tip. I used the distinct directive in addition to your SQL construction.

--
Bertie Brink
Life is a sexually transmitted disease.  R. D. Laing
http://www.setdefault.com/ : http://www.csmonitor.com/
Received on Fri Aug 04 2006 - 14:17:12 CDT

Original text of this message

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