Query Library

Dusan Latkovic submitted this query on: October 10, 2011 4:41pm EDT
TITLE My
SPORTS American Football, Baseball, Basketball, Ice Hockey
QUERY SELECT dn.first_name, dn.last_name, pe.alignment, spread.line_value, bookmakers.bookmaker_key, CONVERT_TZ(events.start_date_time, '+00:00', '-04:00') as game_time, spread.date_time as odds_time
FROM events
JOIN participants_events pe ON (events.id = pe.event_id AND pe.participant_type = 'teams')
JOIN teams t ON pe.participant_id = t.id
JOIN display_names dn ON (dn.entity_id = pe.participant_id AND dn.entity_type = 'teams')
JOIN wagering_straight_spread_lines spread ON (spread.event_id = events.id AND spread.team_id = t.id)
JOIN bookmakers ON spread.bookmaker_id = bookmakers.id

WHERE events.event_key = 'l.nba.com-2010-e.13749'
ORDER BY odds_time DESC, pe.alignment ASC;
DESCRIPTION This query returns all the odds ever published for a given game. This returns spread values, if available. Total (over/under) and moneylines are in different tables.
DBs TESTED MySQL
ADDITIONAL NOTES