Query Library

Casey Trauer submitted this query on: March 04, 2011 10:26am EST
TITLE Odds
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.

From this query, you should be able modify it to limit to the latest odds set, or to a specific bookmaker or to a specific team. Or expand to more games, such as all of today's games.
DBs TESTED MySQL
ADDITIONAL NOTES
Comments
on October 10, 2011 4:38pm EDT Dusan Latkovic wrote:
Metadata: DB Tested: MySQL
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;

"Yes"