自分用覚書。
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;CentOS上での各種設定やTips、PHPやDB関係のことなど
自分用覚書。
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;