I need to sum several fields then take product and use it in another calculation. For example:
select sum(day_hrs)+sum(night_hrs)+sum(day_ot_hrs)+sum(night_ot_hrs) as total_hrs from Craft where weeklyuid = @weekid and craft_category = 'Boilermaker'
select sum(day_hrs)+sum(night_hrs)+sum(day_ot_hrs)+sum(night_ot_hrs) as apprentice_hrs from Craft where weeklyuid = @weekid and craft_category = 'Boilermaker' and craft_group = '3'
Once total_hrs and apprentice_hrs has been calculated I need to do the following:
ratio = apprentice_hrs / total_hrs
Whats the best way to do this?
Dave
select sum(day_hrs)+sum(night_hrs)+sum(day_ot_hrs)+sum(night_ot_hrs) as total_hrs from Craft where weeklyuid = @weekid and craft_category = 'Boilermaker'
select sum(day_hrs)+sum(night_hrs)+sum(day_ot_hrs)+sum(night_ot_hrs) as apprentice_hrs from Craft where weeklyuid = @weekid and craft_category = 'Boilermaker' and craft_group = '3'
Once total_hrs and apprentice_hrs has been calculated I need to do the following:
ratio = apprentice_hrs / total_hrs
Whats the best way to do this?
Dave