Robuta

https://neon.com/postgresql/tutorial/grouping-sets PostgreSQL GROUPING SETS Show you how to use PostgreSQL GROUPING SETS to generate a result set equivalent to the one generated by the UNION ALL of multiple GROUP BY clauses. grouping setspostgresql