1. Extract the Highs and Lows of the day and the times they occur.
Can't remember the structure... is it like (stockTicker, Date, Time, Price)? If so, you can do something like
And then you can join that back to the original table on (stockTicker, MaxPrice) and get the / a related time. (If the stock were at the MaxPrice more than once, more than one value would be returned, so you'd have to choose which to keep.Code:SELECT stockTicker, Date, MAX(Price) AS MaxPrice FROM table GROUP BY stockTicker, Date