Top 3 by Sum of Value
So this is what I did. I created one query to collect
all scrap parts by date range selected:
SELECT ScrapData.ScrapDate, ScrapData.PartNo, ScrapData.Description,
ScrapData.CostCtr, ScrapData.Value
FROM ScrapData
WHERE (((ScrapData.ScrapDate) Between [Forms]![frmWeeklyrpt]!
[FromDate] And [Forms]![frmWeeklyrpt]![ToDate]));
took that query (qryPart1)
And created the following to give my top 3:
SELECT TOP 3 qryPart1.PartNo, qryPart1.Description, Sum
(qryPart1.Value) AS SumOfValue
FROM qryPart1
GROUP BY qryPart1.PartNo, qryPart1.Description
ORDER BY Sum(qryPart1.Value) DESC;
|