Question : return max for each group

I have an experts sql which works perfect if my initial query has criteria added for a specific model, if i remove the criteria i only get the total max and not the max for each group
1:
2:
3:
4:
5:
6:
7:
8:
9:
Qrylifecyclemodels
SELECT QryDateDifModels.[MODEL RANGE], QryDateDifModels.Expr1 AS [Life Cycle], Count(QryDateDifModels.Expr1) AS [Total vehicles]
FROM QryDateDifModels
GROUP BY QryDateDifModels.[MODEL RANGE], QryDateDifModels.Expr1;


SELECT QryLifeCycleModels.[Life Cycle] AS [Life Cycle], QryLifeCycleModels.[Total vehicles] AS [Maximum Total Vehicles], QryLifeCycleModels.[model range]
FROM QryLifeCycleModels
WHERE (((QryLifeCycleModels.[Total vehicles])=(select max([Total vehicles]) from QryLifeCycleModels)));
Attachments:
 
example
 

Answer : return max for each group

so, the subquery has to be done using Model Range ...
1:
2:
3:
4:
SELECT t.[Life Cycle] AS [Life Cycle], t.[Total vehicles] AS [Maximum Total Vehicles], t.[model range]
FROM QryLifeCycleModels t
WHERE (((t.[Total vehicles])=(select max(i.[Total vehicles]) from QryLifeCycleModels i where i.[model range] = t.[model range] )));
Random Solutions  
 
programming4us programming4us