diff --git a/route_sql/build/list_changes_table.sql b/route_sql/build/list_changes_table.sql index a523deb..3011b65 100644 --- a/route_sql/build/list_changes_table.sql +++ b/route_sql/build/list_changes_table.sql @@ -1,6 +1,6 @@ SELECT iterdef->>'user' "user", - iterdef->>'stamp' "stamp", + (iterdef->>'stamp')::timestamptz "stamp", iterdef->>'mesasage' "comment", round(SUM(fb_val_loc * r_rate)::numeric,2) sales, jsonb_pretty(iterdef) def @@ -13,3 +13,5 @@ GROUP BY iterdef->>'stamp', iterdef->>'message', iterdef +ORDER BY + "stamp" DESC diff --git a/route_sql/new_basket.sql b/route_sql/new_basket.sql index 66f2dda..c4ed2f7 100644 --- a/route_sql/new_basket.sql +++ b/route_sql/new_basket.sql @@ -581,7 +581,7 @@ FROM LEFT OUTER JOIN LGDAT.CUST BC ON BC.BVCUST = b.BILL_CUST LEFT OUTER JOIN LGDAT.CUST SC ON - SC.BVCUST = b.BILL_CUST + SC.BVCUST = b.SHIP_CUST LEFT OUTER JOIN RLARP.FFCHNL c ON c.BILL = bc.bvclas AND c.SHIP = sc.bvclas @@ -784,4 +784,4 @@ GROUP BY ,version ,iter ) -SELECT json_agg(row_to_json(insagg)) x from insagg \ No newline at end of file +SELECT json_agg(row_to_json(insagg)) x from insagg