table weather (date, temphi, templo).
Looks like this:
2010-7-24, 83, 57
2010-7-25, 94, 60
2010-7-26, 98, 58
2010-7-27, 93, 61
2010-7-28, 87, 59
Statement is:
SELECT date, max(temphi) from weather;
I expected 2010-7-26, 98 but got 2010-7-24, 98, clearly the wrong date on which the high temperature was reported.
All tables with all such data erroneously return the first row's element (in this case the first date) but correctly give the high temp, 98.
Is there a way to do this that works? Thanks