I have a table of Albums
that has a date
column named release_date
.
I want to get a list of all the month + year combinations present along with the number of albums released in that month/year.
So, the output might be something like:
- November 2016 - 11
- October 2016 - 4
- July 2016 - 19
- December 2015 - 2
Ruby 2.3.1 w/ Rails 5 on Postgres 9.6, FWIW.
select to_char(release_date, 'Month YYYY'), count(*) from albums group by 1;
– Carmon