From 7d0166aab290f1fe113bfc5df52745785ddf8c3f Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Thu, 21 Mar 2019 03:23:07 -0400 Subject: [PATCH] template out necessary function --- route_sql/new_part.sql | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/route_sql/new_part.sql b/route_sql/new_part.sql index e73e248..fdce944 100644 --- a/route_sql/new_part.sql +++ b/route_sql/new_part.sql @@ -13,7 +13,7 @@ target AS (select $${"scenario":{"quota_rep_descr":"10032 - BRYAN HILL","part_gr JOIN LATERAL json_each(def->'months') je ON true JOIN LATERAL json_to_record(je.value) as r (amount numeric, qty numeric) ON TRUE ) -select * from newm +--select * from newm ,GLD AS ( SELECT N1COMP COMP @@ -135,7 +135,13 @@ select * from newm FROM mmix ) -select * from mmixp +SELECT + t.* + ,x.* +FROM + newm t + --need to build this function + JOIN LATERAL get_closest(pick_from_json) x ON true ,closest AS ( SELECT