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

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

Other related posts: