Agree with above: reference proper indexes, possibly defining a sub-population.
t-sql also offers 10 levels of nesting in CASE statements. I've noticed a minor amount of duplicate logic in your case streams. (This may be a minor point, considering the size and organization of your data.)




Reply With Quote