Thank you, that did not work. I have very similar code in other subqueries (select something from snapshottable2 as [st] where [st].[something]= etc) and it works OK, but this is the first time I used max in a subquery in recent memory.
But, coming up soon, I will be potentially using BASE SAS's proc sql , and I have been doing anything that comes along to help me hone my skills in writing pure unadulterated ANSI SQL, which includes embracing Access subqueries, to the extent that THEY embrace ansi sql, which I believe they generally do.
Basically I wanted to use the chance to do a (perhaps unnecessary) subquery. Also, I didn't want to convert the whole thing to a Totals query.
The reason I didn't want to do this is because I thought it may "mess up" (or require too much more tuning) the rest of the query.
I know what I am about to say might be a terribly non-optimized approach, but sometimes I write a subquery to get an aggregate function instead of converting the query to a Totals query because either 1) I can't group by a subquery, and I already have OTHER subqueries, 2) I'm not sure I want to convert the whole thing to a Totals query.
Using a subquery will always be slow. Using a subquery for no reason instead of a Max expression is inefficient.
In any case using Max(FieldName) as a query field isn't the same as using an aggregate query