Como agrupar e concatenar matrizes com todas as colunas no PostgreSQL
SELECT DATE_TRUNC('day', date_time), JSON_AGG(t) AS row, SUM(amount) AS total
FROM table_a t GROUP BY DATE_TRUNC('day', date_time);
Muddy Markhor