(
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?
Maybe you try to solve that problem with the wrong tool; databases are, normally, not made to execute arithmetic operations.
I don’t agree at all, database is a good tool to manipulate and aggregate data
Обсуждают сегодня