Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 17 Nov 2004 @ 19:48:33 GMT


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


Subj:   Re: CAST instead of CASE
 
From:   Jim Downey

We are having problems using CASE because the optimizer is not working efficiently when statistics are not available. (anyone else sharing this pain? ) If this is your case, you could build an external table with the range of values MinValue and MaxValue and join into this table where NumericValue Between MinValue and MaxValue.

eg

     Sel   a.column1
     ,     a.column2
     ,     b.RangeName
     From  DataTable a
     Inner Join RangeTable b
     Where a.NumericValue between b.MinValue and b.MaxValue
     ;

Mkae sure your range table does not return two rows when the NumericValue = both a MinValue and a.maxValue.


Jim



     
  <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