All, this should be so simple and yet I can't figure it out. I have a table containing hourly volumes for a number of days (see excerpt below).
How do I write an access query that in addition to finding the maximum "totvol" for each day also returns the hour in which TotVol occurs? So, from the table below I need to return two rows:
Day Hour TotVol
18-Jun-13 15 1563
19-Jun-13 5 1111
Retrieving the maximum TotVol value for each day is easy, but how do I get the associated hour?
Thanks for offering your time to help me out--I tried both suggestions.
Unfortunately, hnsar's code simply replicates the original table (tblYourTable)--not sure why,
Flyster's query comes very close, but it sometimes returns two rows for the same day, with different values for TotVol and Hour. Once I joined the table and query on the day fields as well, I got the result I was looking for.
Open in new window