Friday, August 29, 2008

Basic Analytic Rank



--Ranks the institution by who has the greatest count.
--Rank()

select displaygroupdesc
, institution
, count(*) count
, rank() over (order by count(*) desc) ranking
from tabletemp
where createddate between
to_date('01-01-2007','DD-MM-YYYY')
and to_date('31-12-2007','DD-MM-YYYY')
and displaygroupdesc = 'display1'
group by displaygroupdesc, institution



*****************************************
keywords rank()
*****************************************

No comments: