开发者

Microsoft Access Query to SUM & SORT in a query

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜