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: top N with respect to day and other field

Re: top N with respect to day and other field

From: Nikolas Tautenhahn <virtual_at_gmx.de>
Date: Fri, 10 Aug 2007 08:03:57 +0200
Message-ID: <f9gv4c$jat$02$1@news.t-online.com>


Hi,

Charles Hooper wrote:
> Now, a quick test with the DENSE_RANK analytical function, segregating
> the data any time C_DATE or LUP_DIR changes, and ordering by the
> NUM_HITS in descending order:
> SELECT
> C_DATE,
> LUP_PAGE,
> LUP_DIR,
> NUM_HITS,
> DENSE_RANK() OVER (PARTITION BY C_DATE,LUP_DIR ORDER BY NUM_HITS
> DESC) RANKING
> FROM
> T1;

Now this looks very promising and simple to me... Strange enough I looked through the dense_rank() function yesterday but could not find it  useful for the problem... Well, now I know better ;-)

Thanks a lot, this is one nice clean query...

Regards,
N. Received on Fri Aug 10 2007 - 01:03:57 CDT

Original text of this message

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