correction
SELECT TOP 50 * FROM (
SELECT InvMovements.TrnYear, InvMovements.TrnMonth, InvMovements.StockCode,
InvMaster.Description, InvMovements.Customer, sum(InvMovements.TrnQty) TrnQty,
Sum(InvMovements.TrnValue) TrnValue, Sum(InvMovements.CostValue) CostValue,
Sum(InvMaster.MaterialCost * InvMovements.TrnQty) AS Material,
Sum(InvMaster.LabourCost * InvMovements.TrnQty) AS Labor,
Sum(InvMaster.SubContractCost * InvMovements.TrnQty) AS OSP,
Sum(InvMaster.VariableOverhead * InvMovements.TrnQty) AS VOH,
Sum(InvMaster.FixOverhead * InvMovements.TrnQty) AS FOH,
sum(InvMovements.TrnValue - InvMovements.CostValue) AS Margin,
FROM InvMaster InvMaster INNER JOIN
InvMovements InvMovements ON InvMaster.StockCode = InvMovements.StockCode
WHERE (InvMovements.MovementType = 'S') AND (InvMovements.TrnYear = 2010) AND (InvMovements.TrnMonth = 6)
GROUP BY InvMovements.TrnYear, InvMovements.TrnMonth, InvMovements.StockCode,
InvMaster.Description, InvMovements.Customer
) SQ
ORDER BY TrnValue desc