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: SQL prodecure to compute ranking

Re: SQL prodecure to compute ranking

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Thu, 12 Sep 2002 22:31:27 +0100
Message-ID: <alr1eb$lji$2$8302bc10@news.demon.co.uk>

There is a potential problem with a solution of this type, that depends on the requirements for tied places. The rownum is not the rank if you have tied scores.

--
Regards

Jonathan Lewis
http://www.jlcomp.demon.co.uk

Next Seminar dates:
(see http://www.jlcomp.demon.co.uk/seminar.html )

____England______September 24/26, November 12/14

____USA__________November 7/9 (MI), 19/21 (TX)

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html








Candido Dessanti wrote in message <3D7F51D6.1090801_at_blunet.it>...

>that's solution of mine if you dont want to
>use oracle's analytic functions
>
>select b.* from
>(select rownum as rank,
> id_user,
> points
> from (select * from users
> order by points desc)
>) a,
>(select rownum as rank,
> id_user,
> points
> from (select * from users
> order by points desc)
>) b
>where a.id_utente=5
>and b.rank < a.rank+3
>and b.rank > a.rank-3
>/
>
>would this fits your requirements?
>(just 2 sorts maybe avoidable with indexes)
>
Received on Thu Sep 12 2002 - 16:31:27 CDT

Original text of this message

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