Archives of the TeradataForum
Message Posted: Wed, 17 Nov 2004 @ 19:48:33 GMT
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
|