SELECT ISNULL(ProductMixes.ClientCode, '') As Client , ISNULL(ProductMixes.ProjectCode, '') AS Project , ProductMixes.ProductCode , ROUND(SUM(ProductMaterialWeights.BatchWeight * PlantMaterialCosts.DeliveredCost /1000), 2) AS Cost FROM ProductMixes LEFT JOIN ProductMaterialWeights ON ProductMixes.DesignProductRelationUniqueID = ProductMaterialWeights.DesignProductRelationUniqueID AND ProductMixes.ProductCode = ProductMaterialWeights.ProductCode AND ProductMixes.Version = ProductMaterialWeights.MixVersion LEFT JOIN PlantMaterialCosts ON ProductMixes.Plant = PlantMaterialCosts.PlantCode AND ProductMaterialWeights.MaterialCode = PlantMaterialCosts.MaterialCode WHERE ProductMixes.Plant = 'XAT' AND ProductMixes.Active = 1 GROUP BY ISNULL(ProductMixes.ClientCode, '') , ISNULL(ProductMixes.ProjectCode, '') , ProductMixes.ProductCode ORDER BY ISNULL(ProductMixes.ClientCode, '') , ISNULL(ProductMixes.ProjectCode, '') , ProductMixes.ProductCode