Query Library

Maxim Kostenko submitted this query on: August 13, 2012 2:17am EDT
TITLE tr
SPORTS Soccer
QUERY SELECT events.*

FROM events
JOIN affiliations_events ae ON ae.event_id = events.id
JOIN affiliations a ON ae.affiliation_id = a.id
JOIN participants_events pe ON pe.event_id = events.id
JOIN teams t ON pe.participant_id = t.id
JOIN team_phases tp ON t.id = tp.team_id
JOIN affiliations a2 ON tp.affiliation_id = a2.id
JOIN publishers pub ON t.publisher_id = pub.id

WHERE pub.publisher_key = 'sportsnetwork.com'
AND a.affiliation_key = 'l.mlb.com'
AND pe.alignment = 'home'
AND pe.participant_type = 'teams'
AND a2.affiliation_type = 'conference'
AND a2.affiliation_key = 'c.national'
AND events.start_date_time > '2009-08-06 09:00:00'
AND events.start_date_time < '2009-08-07 09:00:00'
DESCRIPTION dfd
DBs TESTED MySQL
ADDITIONAL NOTES