forecast_api/inquirey/list_changes_table.sql

20 lines
407 B
SQL

SELECT
iterdef->>'user' "user",
quota_rep_descr,
(iterdef->>'stamp')::timestamptz "stamp",
iterdef->>'type' "type",
round(SUM(fb_val_loc * r_rate)::numeric,2) sales,
jsonb_pretty(iterdef) def
FROM
rlarp.osm_fcpool
WHERE
iterdef IS NOT NULL
GROUP BY
iterdef->>'user',
quota_rep_descr,
iterdef->>'stamp',
iterdef->>'type',
iterdef
ORDER BY
"stamp" DESC