月ごとの集計をするSQL

自分用覚書。 Postgresqlで月ごとの集計をするSQLは以下のような感じで。 select date_part('year', created) as year, date_part('month', created) as month, sum(price) as sum_price from sales group by year,month order by year,month;