You are using two instances of your one table. In order for SQL to know that
there are two instances being used and which instance of the table to use you
must assign a name to the second instance.
(BY two instances I mean you are pointing the one table twice, not that you
have a duplicate table).
So Temp is a name for the second instance.
To build this query in DESIGN view
== Add your table to the query
== Add the fields you want to see
== Under field F2 you would type the following into the criteria (all as one line)
=(SELECT Max([F2]) FROM [YourTable] as TEMP
WHERE Temp.[F1]=[YourTable].[F1])
What happens is that for every record in the table, the sub-query (in the
criteria) gets the Max value of F2 for the records that have the current value
of F1 in the main query. Then it decides whether or not that Max of F2 field
matches the current value of the F2 field in the main query.
John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County
Thanks
but
(SELECT Max(F2) FROM [YourTable] as TEMP WHERE Temp.F1 = [YourTable].F1)
I don't understand what is difference between TEMP (Field?) and Temp (Table?)
.