Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Mon, 25 Feb 2013 @ 10:08:59 GMT


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


Subj:   How to find Minimum of 3 or more columns?
 
From:   sughesh iyyani

Hi Experts,

How we can find minimum of 3 or more columns other than using nested CASE?

I want to find minimum of records in a row not in entire table.

Currently I am using nested CASE, but it will be very complicated when we need to find min of more columns

Is there anything better than below -

     Case
         When (Col1 <= Col2) And (Col1 <= Col3)
             Then Col1
         When (Col2 <= Col1) And (Col2 <= Col3)
             Then Col2
         Else Col3
     End

If columns to be compared are more, it will be complicated.


Thanks,

Sughesh.



     
  <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: 27 Dec 2016