Skip to content

Instantly share code, notes, and snippets.

@phillijw
Created July 11, 2018 20:38
Show Gist options
  • Save phillijw/8b2683cefe01931107486735af393d21 to your computer and use it in GitHub Desktop.
Save phillijw/8b2683cefe01931107486735af393d21 to your computer and use it in GitHub Desktop.
SELECT
es.SubCategoryName
,es.ClientProductID
,es.ProductSID
,CAST(ps.DATE AS DATE) DATE
,Price
,Cost
FROM ProductStatus ps
JOIN v_EnterpriseStructure es ON es.ProductSID = ps.ProductSID
JOIN PriceZone pz ON pz.PriceZoneID = ps.PriceZoneID
WHERE es.ProductSID = '9577C393-833B-4ACB-9A8E-8B748C65A488'
AND CAST(ps.DATE AS DATE) = CAST('2014-12-17' AS date)
GROUP BY
es.SubCategoryName
,es.ClientProductID
,es.ProductSID
,ps.DATE
,ps.Price
,ps.Cost;
or
SELECT es.SubCategoryName, es.ClientProductID, es.ProductSID, CAST(ps.DATE AS DATE) DATE, Price, Cost
FROM ProductStatus ps
JOIN v_EnterpriseStructure es ON es.ProductSID = ps.ProductSID
JOIN PriceZone pz ON pz.PriceZoneID = ps.PriceZoneID
WHERE es.ProductSID = '9577C393-833B-4ACB-9A8E-8B748C65A488'
AND CAST(ps.DATE AS DATE) = CAST('2014-12-17' AS date)
GROUP BY es.SubCategoryName, es.ClientProductID, es.ProductSID, ps.DATE, ps.Price, ps.Cost;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment