pico=# select sum(1), date_trunc('month', updated_at) as month from projects group by month order by month DESC; sum | month -----+--------------------- 43 | 2024-10-01 00:00:00 46 | 2024-09-01 00:00:00 45 | 2024-08-01 00:00:00 29 | 2024-07-01 00:00:00 17 | 2024-06-01 00:00:00 27 | 2024-05-01 00:00:00 39 | 2024-04-01 00:00:00 59 | 2024-03-01 00:00:00 44 | 2024-02-01 00:00:00 9 | 2024-01-01 00:00:00 2 | 2023-11-01 00:00:00 6 | 2023-10-01 00:00:00 5 | 2023-09-01 00:00:00 1 | 2023-08-01 00:00:00 (14 rows)