note: PRICELISTID is hardcoded on this query. to adjust for other companies. Moreover, it's assumed to be for a pricing per WH implementation.
updated version: now includes non-existing pricelist rows (other than only those with a 0)
select S.StockLink ,S.Code as StockCode ,S.Description_1 ,S.ItemGroup ,W.WHWhseID as WHID ,WW.Code as WHCode ,P.IDPriceListPrices ,P.bUseMarkup ,P.fMarkupRate ,P.fExclPrice from WhseStk W left join WhseMst WW ON W.WHWhseID = WW.WhseLink left join StkItem S ON W.WHStockLink = S.StockLink left join _etblPriceListPrices P ON P.iWarehouseID = W.WHWhseID AND P.iStockID = S.StockLink AND P.iPriceListNameID = 154 WHERE --S.Code = 'TY-25.00-23.50-MW6L4' S.ItemGroup IN ('FORIMP','GRAIMP','OTRIMP','PASIMP','PASRIM','RETSTO','RIMNEW','TBRBUD','TBRMID','TBRPRE','TTIMPO','TTNEWT','TYRFIL') and COALESCE(fExclPrice,0) = 0 and COALESCE(fMarkupRate,0) = 0 ORDER BY S.ItemGroup, S.Code, WW.Code