Query Library

Casey Trauer submitted this query on: May 29, 2009 5:17pm EDT
TITLE Motor racing roster list
SPORTS Motor Racing
QUERY SELECT DISTINCT p.person_key, dn.full_name
FROM persons p
JOIN stats s ON s.stat_holder_id = p.id
JOIN events e ON s.stat_coverage_id = e.id
JOIN events_sub_seasons ess ON e.id = ess.event_id
JOIN sub_seasons ss ON ess.sub_season_id = ss.id
JOIN seasons sns ON ss.season_id = sns.id
JOIN affiliations a on sns.league_id = a.id 
JOIN display_names dn ON dn.entity_id = p.id
WHERE s.stat_holder_type = 'persons'
AND s.stat_coverage_type = 'events'
AND e.event_status = 'post-event' 
AND ss.sub_season_key = '2009_season_regular'  /*Just another way to filter only for 2009 season events*/
AND sns.season_key = '2009'
AND a.affiliation_key = 'l.nascar.com.1' /*Just another way to filter only for Sprint circuit*/
AND dn.entity_type = 'persons';
DESCRIPTION The Sports Network does not send a roster of drivers for a given circuit. So to generate a list of active drivers, the next best solution is to query for drivers who have results in this season or the last season. It is not a perfect solution, but this is how you can do it.
DBs TESTED MySQL
ADDITIONAL NOTES
Your log.directory config setting does not point to a writable directory.