start working on pulling history by part group and data segment

This commit is contained in:
Paul Trowbridge 2025-08-05 20:14:52 -04:00
parent 533bbd1046
commit 7a73748b2a

View File

@ -3,14 +3,15 @@
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
DELETE FROM pricing.lastprice; DELETE FROM pricing.lastprice;
WITH
WITH srt AS ( --------SORT--------
srt AS (
SELECT SELECT
customer, "Customer" customer,
mold, "Part Group" partgroup,
part, i.v1ds dataseg,
version, "Data Source" version,
qty, "Units" qty,
ROUND(sales_usd / qty, 5) AS price, ROUND(sales_usd / qty, 5) AS price,
odate, odate,
oseas, oseas,
@ -20,7 +21,10 @@ WITH srt AS (
PARTITION BY customer, mold, part, version PARTITION BY customer, mold, part, version
ORDER BY odate DESC ORDER BY odate DESC
) AS rn ) AS rn
FROM rlarp.osm_stack FROM
rlarp.osm_stack_pretty o
INNER JOIN CMSInterfaceIn.[CMS.CUSLG].ITEMM i ON
i.item = o.part
WHERE WHERE
--quotes can't be integrated until we have datasegment or correct part code --quotes can't be integrated until we have datasegment or correct part code
version IN ('Actual'/*,'Quotes'*/) AND version IN ('Actual'/*,'Quotes'*/) AND