Suppose I have a table with some natural grouping and ordering, for example records by date, where the records for any given date are ordered by some other differentiator field
1 July, 1, 56.6
1 July, 2, 45.8
1 July, 3, 78.9
2 July, 1, 34.2
2 July, 2, 26.7
I want to select the records with the highest differentiator for each day, for example, to get at
1 July, 3, 78.9
2 July, 2, 26.7
in this simple case. I can’t think how to structure a query to retrieve those records. So far I’m pulling back the whole set and selecting in Java – not really what i want to do.
Perhaps something like,