2011-04-29 43 views
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")) <I will need to look at the GenMedName field here also> 
GROUP BY ptMeds.GenMedName; 

我需要能够SUM基于ptMeds.GenMedName然后排序结果从最高到最低。我已经通过对类似问题的其他回应,但无法准确找到我需要做的事情。任何帮助将不胜感激。Microsoft Access查询SUM和排序在查询

+1

你能举一个你期望结果集看起来像什么的例子吗?你想总结什么样的领域? – JeffO 2011-04-29 17:59:14

回答

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;