开发者

Microsoft Access Query to SUM & SORT in a query

开发者 https://www.devze.com 2023-03-02 03:30 出处:网络
SELECT ptMeds.Station, ptMeds.TxDate, ptMeds.PaType, ptMeds.GenMedName, ptMeds.Strength, ptMeds.UnitsM, ptMeds.Volume, ptMeds.Dosage
SELECT ptMeds.Station, ptMeds.TxDate, ptMeds.PaType, ptMeds.GenMedName, 
ptMeds.Strength, ptMeds.UnitsM, ptMeds.Volume, ptMeds.Dosage
FROM ptMeds
WHERE (((ptMeds.Station)="EMER1开发者_StackOverflow社区") AND ((ptMeds.PaType)="WITHDRAWN")) <I will need to look at the GenMedName field here also>
GROUP BY ptMeds.GenMedName;

I need to be able to SUM based on ptMeds.GenMedName and then sort the results highest to lowest. I've looked thru other responses to similar question but cannot find exactly what I need to do. Any help would be greatly appreciated.


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消