This commit is contained in:
Paul Trowbridge 2019-03-23 17:17:46 -04:00
parent 1f9623e026
commit 7643a6961d

View File

@ -1,21 +1,21 @@
WITH WITH
list AS ( list AS (
SELECT SELECT
iterdef->>'user' "user", iterdef->>'user' "user",
iterdef->>'stamp' "stamp", iterdef->>'stamp' "stamp",
iterdef->>'mesasage' "comment", iterdef->>'mesasage' "comment",
round(SUM(fb_val_loc * r_rate)::numeric,2) sales, round(SUM(fb_val_loc * r_rate)::numeric,2) sales,
jsonb_pretty(iterdef) def jsonb_pretty(iterdef) def
FROM FROM
rlarp.osm_fcpool rlarp.osm_fcpool
WHERE WHERE
iterdef IS NOT NULL iterdef IS NOT NULL
AND iterdef @> $$replace_user$$::jsonb AND iterdef @> $$replace_user$$::jsonb
GROUP BY GROUP BY
iterdef->>'user', iterdef->>'user',
iterdef->>'stamp', iterdef->>'stamp',
iterdef->>'message', iterdef->>'message',
iterdef iterdef
) )
SELECT SELECT
jsonb_agg(row_to_json(list)::jsonb) x from list jsonb_agg(row_to_json(list)::jsonb) x from list