Hi
I would be grateful if some one can help me convert this sql query into a BAQ or is there a better way please.
SELECT p.ShortChar01 AS SkuType, ISNULL(w.OnHandQty, 0) - ISNULL(w.DemandQty, 0) + ISNULL(x.BalQty, 0) AS AvailQty
FROM Part AS p WITH (NOLOCK)
INNER JOIN PartWhse AS w WITH (NOLOCK) ON p.Company = w.Company AND p.PartNum = w.PartNum
LEFT OUTER JOIN
(SELECT d.PartNum, r.WarehouseCode, SUM(r.RelQty - r.ReceivedQty) AS BalQty
FROM PODetail d WITH (NOLOCK)
INNER JOIN PORel r WITH (NOLOCK) ON d.Company = r.Company AND d.PONUM = r.PONum AND d.POLine = r.POLine
WHERE r.RelQty - r.ReceivedQty > 0 AND d.VoidLine = 0 AND d.OpenLine = 1 AND r.VoidRelease = 0 AND r.OpenRelease = 1
GROUP BY d.PartNum, r.WarehouseCode) x ON p.PartNum = x.PartNum AND w.WarehouseCode = x.WarehouseCode
WHERE p.PartNum = @p AND w.WarehouseCode = @w
I’m not sure anyone is going to do it for you, but if you have specific questions while attempting to do it yourself, folks would likely be more happy to answer those.