add bulk manipulation scripts
This commit is contained in:
parent
6cdac5ed2d
commit
c112c5a4a4
12136
route_sql/build/mass_scale_price.sql
Normal file
12136
route_sql/build/mass_scale_price.sql
Normal file
File diff suppressed because it is too large
Load Diff
38
route_sql/build/set_cost_cur.sql
Normal file
38
route_sql/build/set_cost_cur.sql
Normal file
@ -0,0 +1,38 @@
|
||||
BEGIN;
|
||||
|
||||
WITH
|
||||
plist AS (
|
||||
SELECT DISTINCT
|
||||
part
|
||||
,plnt
|
||||
FROM
|
||||
rlarp.osm_fcpool
|
||||
)
|
||||
,clist AS (
|
||||
SELECT
|
||||
p.part
|
||||
,p.plnt
|
||||
,COALESCE(im.cgstcs,ip.chstcs, ir.y0stcs) stdcost
|
||||
FROM
|
||||
plist p
|
||||
LEFT OUTER JOIN lgdat.icstm im ON
|
||||
im.cgpart = p.part
|
||||
AND im.cgplnt = p.plnt
|
||||
LEFT OUTER JOIN lgdat.icstp ip ON
|
||||
ip.chpart = p.part
|
||||
AND ip.chplnt = p.plnt
|
||||
LEFT OUTER JOIN lgdat.icstr ir ON
|
||||
ir.y0part = p.part
|
||||
AND ir.y0plnt = p.plnt
|
||||
)
|
||||
UPDATE
|
||||
rlarp.osm_fcpool o
|
||||
SET
|
||||
fb_cst_loc_cur = c.stdcost * o.fb_qty
|
||||
FROM
|
||||
clist c
|
||||
WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
commit;
|
38
route_sql/build/set_cost_fut.sql
Normal file
38
route_sql/build/set_cost_fut.sql
Normal file
@ -0,0 +1,38 @@
|
||||
BEGIN;
|
||||
|
||||
WITH
|
||||
plist AS (
|
||||
SELECT DISTINCT
|
||||
part
|
||||
,plnt
|
||||
FROM
|
||||
rlarp.osm_fcpool
|
||||
)
|
||||
,clist AS (
|
||||
SELECT
|
||||
p.part
|
||||
,p.plnt
|
||||
,COALESCE(im.cnstcs,ip.costcs, ir.y3stcs) stdcost
|
||||
FROM
|
||||
plist p
|
||||
LEFT OUTER JOIN lgdat.ftcstm im ON
|
||||
im.cnpart = p.part
|
||||
AND im.cnplnt = p.plnt
|
||||
LEFT OUTER JOIN lgdat.ftcstp ip ON
|
||||
ip.copart = p.part
|
||||
AND ip.coplnt = p.plnt
|
||||
LEFT OUTER JOIN lgdat.ftcstr ir ON
|
||||
ir.y3part = p.part
|
||||
AND ir.y3plnt = p.plnt
|
||||
)
|
||||
UPDATE
|
||||
rlarp.osm_fcpool o
|
||||
SET
|
||||
fb_cst_loc_fut = c.stdcost * o.fb_qty
|
||||
FROM
|
||||
clist c
|
||||
WHERE
|
||||
c.part = o.part
|
||||
AND c.plnt = o.plnt;
|
||||
|
||||
commit;
|
Loading…
Reference in New Issue
Block a user