Is the "the total for all the provinces" just the count of the billing_province rows for a province multiplied by the cour_charge for that province?if so then can't you simply take the sum of the cour_charge? If you want it by province then add a group by province?select sum(bp.cour_charge) from billable_records brinner join billing_province bp on bp.province_code = br.scan_province
or by province:select br.scan_province ,sum(bp.cour_charge) from billable_records brinner join billing_province bp on bp.province_code = br.scan_provincegroup by br.scan_province ,cour_charge
Be One with the OptimizerTG