From 03e532857d89a196706a23c0b8ebc40a87a8cf22 Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Tue, 25 Feb 2020 10:54:45 -0500 Subject: [PATCH] change time stamp and add sort --- route_sql/list_changes.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/route_sql/list_changes.sql b/route_sql/list_changes.sql index 4b5e69e..50e79b9 100644 --- a/route_sql/list_changes.sql +++ b/route_sql/list_changes.sql @@ -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 \ No newline at end of file