Archives of the TeradataForum
Message Posted: Wed, 30 Apr 2008 @ 17:49:44 GMT
Subj: | | Re: Retrieving the Second Highest Amount |
|
From: | | Michael Larkins |
Hello Magan:
You had the right idea with the OLAP tools and the QUALIFY can go into a view:
replace view sql00.rank_cnt as
sel * from customer
qualify rank() over (partition by customer order by amount desc) =
case when count(*) over (partition by customer) > 1 then 2 else 1 end
Hope this helps,
Michael Larkins
Certified Teradata Master
Certified Teradata SQL Instructor
|