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: Candido Dessanti <termy_at_blunet.it>
Date: Wed, 11 Sep 2002 16:23:18 +0200
Message-ID: <3D7F51D6.1090801@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 Wed Sep 11 2002 - 09:23:18 CDT

Original text of this message

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