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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: I still have trouble wrapping my head around these analytical functions (should be simple?)

Re: I still have trouble wrapping my head around these analytical functions (should be simple?)

From: jan van mourik <jan.vanmourik_at_gmail.com>
Date: Thu, 30 Nov 2006 20:59:33 -0600
Message-ID: <396f1c9e0611301859r4911625eh993ba59eb97f7574@mail.gmail.com>


What about

select distinct id, smallest, largest, rank () over (order by smallest, largest) as rank
from (
select distinct id, smallest, largest
 from
(select id

 ,      min(value) over (partition by id) smallest
 ,      max(value) over (partition by id) largest
 from zzz
)
)

order by rank
;

 Analytic functions all the way :-)

 jan

--
http://www.freelists.org/webpage/oracle-l
Received on Thu Nov 30 2006 - 20:59:33 CST

Original text of this message

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