Thanks for this. Those comments focus on creating a 'standard time' based on the mean. I am considering an approach which determines how good a race was based on the percentile of the winning time, and ultimately an individual rating that accounts for lengths beaten. I think adjusting for weight could be tricky. I would welcome any thoughts. My query is as follows:
SELECT
(
100 *
(
SELECT COUNT(*)
FROM historic_races_beta
WHERE race_type = 'All Weather Flat'
AND going = 'Standard'
AND course = 'Chelmsford_City'
AND distance_yards = 1540
AND winning_time_secs <= 68.1
)
/
(
SELECT COUNT(*)
FROM historic_races_beta
WHERE race_type = 'All Weather Flat'
AND going = 'Standard'
AND course = 'Chelmsford_City'
AND distance_yards = 1540
)
) AS percentile_position,
(
SELECT COUNT(*)
FROM historic_races_beta
WHERE race_type = 'All Weather Flat'
AND going = 'Standard'
AND course = 'Chelmsford_City'
AND distance_yards = 1540
) AS record_count
FROM historic_races_beta
LIMIT 1