SELECT areaid ,to_char((createtime),'yyyy-mm-dd') createtime ,AVG(idx:: NUMERIC) FROM "XX" where createtime>='2021-09-01 00:00:00' GROUP BY areaid,to_char((createtime),'yyyy-mm-dd') ORDER BY createtime desc
SELECT areaid ,to_char((createtime),'yyyy-mm-dd') createtime ,AVG(idx:: NUMERIC) FROM "XX" where createtime>='2021-09-01 00:00:00' GROUP BY areaid,to_char((createtime),'yyyy-mm-dd') ORDER BY createtime desc