SubQuery.mdb (beginner)

Please consider donating $1 per sample downloaded, find out why here
Access 97 (11 KB)

The question is, how do you write a query which find the maximum value of a given group, but then returns all of the values associated with that record? A simple Totals query won't do it. If you try to add other fields, it will group on those as well. If you use some other function like FIRST, you will get just the first value of the other field it can find, not the value that is associated with the value returned with MAX.

The solution is to use a subquery. In a sub query, you return a list of values to the main query which you can evaluate in the WHERE clause with the IN operator.




Need Winzip?

Return to Main Page