• 2.1k
  • 27
  • 1.7k

calculate average consumption per area,it looks like it should work?

Aug 28 2022 11:55 AM

I need help with mysql query

select city, sum(sub.area_consumption) from (
  select city, sum(amount_streetlight) / consumption as area_consumption
  from MuniLEIMS.statisticalreport
  group by city, area
) as sub
group by sub.city

I'm trying to calculate average consumption per area (every city has many areas)
it looks like it should work?

Answers (3)