I would split it in two selects. The first calculates woHours and totalHours and the second uses calculated values.
>I'm build a cursor to use for a report and need to repeat the same sum() many times. Is there a way to resuse a calculated field again?
>
>This is an example, but I have to create hours and ratios for a dozen different time types:
>
Select sum(ts.nHours) as totalHours, ;
> Sum(IIF(ts.fk_timetype_id = 1, 1, 0)) As woHours, ;
> ** The following is repeating the totalHours and woHours sums
> ** is there a way resuse those calculated columns?
> Sum(IIF(ts.fk_timetype_id = 1, 1, 0)) / (sum(ts.nHours) / 100) As woRatio
>
>TIA
--sb--