Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

How to Group by and concatenate arrays with all columns in 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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #Group #concatenate #arrays #columns #PostgreSQL
ADD COMMENT
Topic
Name
9+1 =