2020-02-14 02:24:52 -05:00
|
|
|
WITH
|
2020-02-20 14:26:39 -05:00
|
|
|
agg as (
|
2019-03-23 17:17:46 -04:00
|
|
|
SELECT
|
2020-02-20 14:26:39 -05:00
|
|
|
ol.doc->>'user' "user"
|
|
|
|
,quota_rep_descr
|
2020-02-25 16:49:46 -05:00
|
|
|
,to_char((ol.doc->>'stamp')::timestamptz,'Mon-DD HH24:MI:SS') stamp
|
2020-02-20 14:26:39 -05:00
|
|
|
,ol.doc->>'tag' tag
|
|
|
|
,ol.doc->>'message' "comment"
|
2020-02-25 00:27:30 -05:00
|
|
|
,jsonb_pretty(ol.doc) doc
|
2020-02-20 14:26:39 -05:00
|
|
|
,ol.id
|
2020-02-14 02:24:52 -05:00
|
|
|
,to_char(round(sum(value_usd),2),'$999,999,999D00') sales
|
|
|
|
from
|
2020-02-20 14:26:39 -05:00
|
|
|
rlarp.osm_log ol
|
2020-02-14 02:24:52 -05:00
|
|
|
inner join rlarp.osm_pool on
|
|
|
|
id = logid
|
2020-02-20 14:26:39 -05:00
|
|
|
WHERE
|
|
|
|
quota_rep_descr = 'replace_user'
|
2021-04-12 15:10:45 -04:00
|
|
|
AND tag NOT IN ('Initial Build','last price')
|
2020-02-20 14:26:39 -05:00
|
|
|
group BY
|
|
|
|
ol.doc->>'user'
|
|
|
|
,quota_rep_descr
|
|
|
|
,ol.doc->>'stamp'
|
|
|
|
,ol.doc->>'tag'
|
|
|
|
,ol.doc->>'comment'
|
2020-02-25 00:27:30 -05:00
|
|
|
,jsonb_pretty(ol.doc)
|
2020-02-20 14:26:39 -05:00
|
|
|
,ol.id
|
2020-02-25 10:54:45 -05:00
|
|
|
ORDER BY
|
|
|
|
(ol.doc->>'stamp')::timestamptz desc
|
2019-03-23 17:17:46 -04:00
|
|
|
)
|
|
|
|
SELECT
|
2021-04-12 15:10:45 -04:00
|
|
|
jsonb_agg(row_to_json(agg)::jsonb ORDER BY agg.stamp desc) x from agg
|