I'm new here and have been searching for my problem on this forum without any luck. Hopefully there's someone who can help out
Anyway. I have a table called "Race"
I'm running this Select query:
Cal = "SELECT LapTime, MFName, MLName, Team, SUM(LapTime) AS LSUM FROM Race GROUP BY ManagerID ORDER BY LSUM"
I loop through the recordset.
It works just fine but I would like to get the Last LapTime added by every Manager. As it is now it shows the first post that each manager have set.
I've tried many diffrent things and read the manuals for a solution but with no luck.
So that means GROUP BY "Field that is primarykey, autoinc" are no good?
it means that if you have non-aggregates in the SELECT list, then they must all be in the GROUP BY
your SELECT list looks like this --
, SUM(LapTime) AS LSUM
therefor, your GROUP BY should look like this --
however, while this would be syntactically correct and avoid the unpredictable results that mysql produces if you violate this rule (all other databases will give a syntax error for the "hidden" GROUP BY columns), it isn't what you want
what you want is this --
from Race as R
= ( select max(LapTime)
where ManagerID = R.ManagerID )