Query Library

Casey Trauer submitted this query on: February 09, 2011 6:20pm EST
TITLE Motor racing post-race event stats
SPORTS Motor Racing
QUERY select motor_racing_event_stats.*, motor_racing_event_states.time_elapsed  
FROM events
JOIN stats ON (stats.stat_holder_id = events.id and stats.stat_holder_type = 'events')
JOIN motor_racing_event_stats ON (stats.stat_repository_id = motor_racing_event_stats.id and stats.stat_repository_type = 'motor_racing_event_stats')
JOIN motor_racing_event_states ON events.id = motor_racing_event_states.id
WHERE events.event_key = 'l.nascar.com.1-2010-e.1098'
AND motor_racing_event_states.current_state='1';
DESCRIPTION Describes stats about the race, usually after the race is completed, such as how long it took to complete the race, average speed, number of caution flags and laps, number of lead changes, etc.
DBs TESTED MySQL
ADDITIONAL NOTES