Archives of the TeradataForum
Message Posted: Wed, 27 Nov 2002 @ 16:02:20 GMT
Subj: | | Re: MEDIAN - using SQL |
|
From: | | Belle, Patrick A |
Haven't actually tried this, but you might try something like using a combination of Quantile and Qualify as in the snippet below:
select ...
, colname
, ...
from tabname
qualify colname = quantile(colname,upperlimit)/2
...
colname is the column for which the median is to be calculated upperlimit is largest value colname can have.
You may have to work out some details like preventing multiple rows, etc.
God Luck
Pat Belle
Teradata Certified Master
|