Select query in Access 2007

I have a table in Access 2007 with the following fields: TradeDate, TradeTime, TradePrice. The first two are Date/Time, and the last is a number.

I want to select, for each TradeDate, the record which has the largest TradeTime (i.e. the last trade of the day). How can I do it?
RothbardAsked:
Who is Participating?
 
Patrick MatthewsConnect With a Mentor Commented:
SELECT t1.TradeDate, t1.TradeTime, t1.TradePrice
FROM SomeTable t1 INNER JOIN
    (SELECT t2.TradeDate, Max(t2.TradeTime) AS MaxTime
    FROM SomeTable t2
    GROUP BY t2.TradeDate) AS z ON t1.TradeDate = z.TradeDate And t1.TradeTime = z.MaxTime
ORDER BY t1.TradeDate
0
 
RothbardAuthor Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.