Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 27 Nov 2002 @ 16:02:20 GMT


     
  <Prev Next>   <<First <Prev Next> Last>>  


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



     
  <Prev Next>   <<First <Prev Next> Last>>  
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023