postgres group date by year and month code example Example: postgresql group by month and year date_trunc('month', col_date)