change time stamp and add sort

This commit is contained in:
Trowbridge 2020-02-25 10:54:45 -05:00
parent 787cc9452f
commit 03e532857d

View File

@ -3,7 +3,7 @@ agg as (
SELECT
ol.doc->>'user' "user"
,quota_rep_descr
,ol.doc->>'stamp' stamp
,to_char((ol.doc->>'stamp')::timestamptz,'DD/Mon HH:MI:SS') stamp
,ol.doc->>'tag' tag
,ol.doc->>'message' "comment"
,jsonb_pretty(ol.doc) doc
@ -24,6 +24,8 @@ group BY
,ol.doc->>'comment'
,jsonb_pretty(ol.doc)
,ol.id
ORDER BY
(ol.doc->>'stamp')::timestamptz desc
)
SELECT
jsonb_agg(row_to_json(agg)::jsonb ORDER BY agg.stamp desc) x from agg