I have a table; let it be called table1; with the following fields and data
alt text http://img228.imageshack.us/img228/3827/45939084.png
I need a query that returns the record with the maximum value in Field3 for each group of records having the same value in Field2. So that the query returns:
alt text http://img87.imageshack.us/img87/62/48847706.png
How could this be done using SQL queries ?
This:
or this:
Depending on the
field2cardinality, the first or the second query can be more efficient.See this article for more details: