24 lines
569 B
SQL
24 lines
569 B
SQL
-- DELETE FROM pricequote.price_queue;
|
|
--
|
|
-- ALTER SEQUENCE pricequote.price_queue_id_seq RESTART WITH 1;
|
|
--
|
|
-- INSERT INTO
|
|
-- pricequote.price_queue (bill, ship, part, stlc, v1ds, vol, chan, tier)
|
|
-- SELECT DISTINCT
|
|
-- bill_cust, ship_cust, part, stlc, dataseg, qty, chan, customer_tier
|
|
-- FROM
|
|
-- rlarp.osm_stack;
|
|
|
|
|
|
|
|
UPDATE
|
|
pricequote.price_queue q
|
|
SET
|
|
expl = COALESCE(q.expl, '{}'::jsonb) || jsonb_build_object('price history', l.dataseg_stats)
|
|
FROM
|
|
pricequote.lastprice l
|
|
WHERE
|
|
q.cust = l.customer
|
|
AND q.stlc = l.partgroup;
|
|
|