I think the problem is that I don't understand the logic you're using to determine the months to use. (if mth_00 is the current month, and mth_01 is the previous month, I'd have actually expected you to count from 0 out to the number of months back that you want, and the current date to be insignificant in the calculation)
Anyway, just figure out which mth_xx fields you want, and adjust the line that sets @months_of_support so the logic is correct.
In reply to Re^4: Dynamic SQL script
by jhourcle
in thread Dynamic SQL script
by sasrs99
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |