By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
| version |
|---|
| PostgreSQL 15.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-10), 64-bit |
SELECT 1
BEGIN
CREATE TABLE
INSERT 0 2
| cust_id | item |
|---|---|
| ABC123 | [{"cust_id":"ABC123","cust_name":"test","quantity":1,"item_nme":"a","average_price":10}] |
| LP8338 | [{"cust_id":"LP8338","cust_name":"test1","quantity":2,"item_nme":"b","average_price":11}] |
SELECT 2
| cust_id | array_agg |
|---|---|
| ABC123 | {"(ABC123,test,1,a,10)"} |
| LP8338 | {"(LP8338,test1,2,b,11)"} |
SELECT 2
COMMIT