update quote rep descr and director

This commit is contained in:
pt 2020-03-12 14:20:09 -04:00
parent e201302953
commit f34b0d539d

View File

@ -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 UPDATE
rlarp.osm_pool o rlarp.osm_pool o
@ -80,4 +82,20 @@ WHERE
b.bvcust = rtrim(substring(o.bill_cust_descr,1,8)) b.bvcust = rtrim(substring(o.bill_cust_descr,1,8))
AND s.bvcust = rtrim(substring(o.ship_cust_descr,1,8)); AND s.bvcust = rtrim(substring(o.ship_cust_descr,1,8));
--ROLLBACK; 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;