Archives of the TeradataForum
Message Posted: Thu, 09 Sep 2010 @ 10:07:56 GMT
Subj: | | Re: Excluding Top and Bottom 5 % of records |
|
From: | | Dieter Noeth |
| I am looking at the most efficient method to exclude the top 5% and bottom 5% of records. | |
Instead of quantile (which is non-Standard and therefore deprecated) better use percent_rank, which is quite similar to your calculation:
qualify percent_rank()
over (Partition by Team Order By Results desc)
between 0.05 and 0.95
There's a slight difference between quantile and percent_rank, quantile is based on:
(rank - 1) / count" vs. "(rank - 1) / (count - 1)
Dieter
|