yurko
10/13/2017 - 6:14 PM

sort by year

sort by year

select date_trunc('year', start_date) m, count(id) from events group by m order by m;

select user_id, date_trunc('year', start_date) m, count(user_id) from events group by user_id, m order by user_id;