diff --git a/build/snap_cust_pool.sql b/build/snap_cust_pool.sql index 2477189..df91ed4 100644 --- a/build/snap_cust_pool.sql +++ b/build/snap_cust_pool.sql @@ -1,4 +1,6 @@ ---BEGIN; +BEGIN; + +--SELECT dsm, director, quota_rep_descr, billto_group, shipto_group, sum(value_usd ), count(*) from rlarp.osm_pool where order_season = 2021 group by dsm, director, quota_rep_descr, billto_group, shipto_group; UPDATE rlarp.osm_pool o @@ -80,4 +82,20 @@ WHERE b.bvcust = rtrim(substring(o.bill_cust_descr,1,8)) AND s.bvcust = rtrim(substring(o.ship_cust_descr,1,8)); ---ROLLBACK; \ No newline at end of file +BEGIN; + +UPDATE + rlarp.osm_pool o +SET + quota_rep_descr = c.a30 + ,director = COALESCE(Q.DIR,'Other') +FROM + lgdat.code c + ,rlarp.qrh q +WHERE + LTRIM(RTRIM(c.a9)) = o.dsm + and c.a2 = 'MM' + AND q.qr = LTRIM(RTRIM(c.a9)); + + +ROLLBACK; \ No newline at end of file