用于SUM&的Microsoft Access查询在查询中排序

时间:2011-04-29 13:28:45

标签: ms-access sorting sum

SELECT ptMeds.Station, ptMeds.TxDate, ptMeds.PaType, ptMeds.GenMedName, 
ptMeds.Strength, ptMeds.UnitsM, ptMeds.Volume, ptMeds.Dosage
FROM ptMeds
WHERE (((ptMeds.Station)="EMER1") AND ((ptMeds.PaType)="WITHDRAWN")) <I will need to look at the GenMedName field here also>
GROUP BY ptMeds.GenMedName;

我需要能够基于ptMeds.GenMedName进行SUM,然后将结果从最高到最低排序。我通过其他类似问题的回答看了一眼,但找不到我需要做的事情。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

SELECT ptMeds.Station, ptMeds.TxDate, ptMeds.PaType, ptMeds.GenMedName, 
ptMeds.Strength, ptMeds.UnitsM, ptMeds.Volume, ptMeds.Dosage
FROM ptMeds
WHERE (((ptMeds.Station)="EMER1") AND ((ptMeds.PaType)="WITHDRAWN")) 
GROUP BY ptMeds.GenMedName
ORDER BY ptMeds.GenMedName DESC;