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