L
lay
I need to know how to return just the top 5 DUs (Based on sum of cases lost)
for each Code desc. Below is my current SQL that returns back all records for
all CodeDesc
Please help? Thanks!
SELECT [(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat,
[(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat_Description,
[(0005a1)InternalDrilldown - HPCStockAvail].CutDelayCode,
[(0005a1)InternalDrilldown - HPCStockAvail].CodeDesc,
[(0005a1)InternalDrilldown - HPCStockAvail].DU, [(0005a1)InternalDrilldown -
HPCStockAvail].Description, Sum([(0005a1)InternalDrilldown -
HPCStockAvail].CasesLost) AS SumOfCasesLost
FROM [(0005a1)InternalDrilldown - HPCStockAvail]
GROUP BY [(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat,
[(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat_Description,
[(0005a1)InternalDrilldown - HPCStockAvail].CutDelayCode,
[(0005a1)InternalDrilldown - HPCStockAvail].CodeDesc,
[(0005a1)InternalDrilldown - HPCStockAvail].DU, [(0005a1)InternalDrilldown -
HPCStockAvail].Description
ORDER BY Sum([(0005a1)InternalDrilldown - HPCStockAvail].CasesLost) DESC;
for each Code desc. Below is my current SQL that returns back all records for
all CodeDesc
Please help? Thanks!
SELECT [(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat,
[(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat_Description,
[(0005a1)InternalDrilldown - HPCStockAvail].CutDelayCode,
[(0005a1)InternalDrilldown - HPCStockAvail].CodeDesc,
[(0005a1)InternalDrilldown - HPCStockAvail].DU, [(0005a1)InternalDrilldown -
HPCStockAvail].Description, Sum([(0005a1)InternalDrilldown -
HPCStockAvail].CasesLost) AS SumOfCasesLost
FROM [(0005a1)InternalDrilldown - HPCStockAvail]
GROUP BY [(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat,
[(0005a1)InternalDrilldown - HPCStockAvail].CCFOT_SubCat_Description,
[(0005a1)InternalDrilldown - HPCStockAvail].CutDelayCode,
[(0005a1)InternalDrilldown - HPCStockAvail].CodeDesc,
[(0005a1)InternalDrilldown - HPCStockAvail].DU, [(0005a1)InternalDrilldown -
HPCStockAvail].Description
ORDER BY Sum([(0005a1)InternalDrilldown - HPCStockAvail].CasesLost) DESC;