Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. best_time_id int(10)
  2. lap_id int(11)
  3. start_time int(10)
  4. end_time int(10)
  5. total_distance decimal(7,2)
  6. total_elapsed_time decimal(11,2)
  7.  
  8. SELECT `bt`.`total_distance`, `bt`.`total_elapsed_time`, `bt`.`start_time`
  9. FROM `best_times` AS `bt`, `laps` AS `l`
  10. WHERE (
  11. SELECT COUNT(*) FROM `best_times` AS `bt2`
  12. WHERE `bt2`.`total_distance` = `bt`.`total_distance`
  13. AND `bt2`.`total_elapsed_time` <= `bt`.`total_elapsed_time`
  14. AND `bt2`.`start_time` > `bt`.`start_time`
  15. ) <= 10 AND `l`.`lap_id` = `bt`.`lap_id` AND `l`.`car_id` = 1 ORDER BY `bt`.`total_distance` ASC, `bt`.`total_elapsed_time` desc
  16.  
  17. | total_distance | total_elapsed_time | start_time |
  18. |----------------|--------------------|------------|
  19. | 1000.00 | 99.15 | 1431344798 |
  20. | 1000.00 | 98.25 | 1431604966 | This record shouldn't be here because although it's quicker it happened after the 91.40 time
  21. | 1000.00 | 91.40 | 1431433535 |
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement