Guest User

Untitled

a guest
Apr 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. SELECT events.event_key,
  2. events.id game_id,
  3. CONVERT_TZ(events.start_date_time, 'GMT','America/New_York') as time,
  4. dn_home.abbreviation as home,
  5. dn_home.entity_id as home_id,
  6. dn_away.abbreviation as away,
  7. dn_away.entity_id as away_id,
  8. events.round_number wk
  9. FROM
  10. events
  11. JOIN events_sub_seasons ess ON ess.event_id = events.id
  12. JOIN sub_seasons ss ON ss.id = ess.sub_season_id
  13. JOIN affiliations_events ae ON ae.event_id = events.id
  14. JOIN affiliations a_league ON a_league.id = ae.affiliation_id
  15. JOIN participants_events pe_home ON pe_home.event_id = events.id
  16. JOIN participants_events pe_away ON pe_away.event_id = events.id
  17. JOIN teams t ON t.id = pe_home.participant_id
  18. JOIN display_names dn_home ON pe_home.participant_id = dn_home.entity_id
  19. JOIN display_names dn_away ON pe_away.participant_id = dn_away.entity_id
  20.  
  21. WHERE
  22. ss.sub_season_key = '2011_season_regular'
  23. AND a_league.affiliation_key = 'l.nfl.com'
  24. AND a_league.affiliation_type = 'league'
  25. AND pe_home.alignment = 'home'
  26. AND pe_home.participant_type = 'teams'
  27. AND pe_away.alignment = 'away'
  28. AND pe_away.participant_type = 'teams'
  29. AND dn_home.entity_type = 'teams'
  30. AND dn_away.entity_type = 'teams'
Add Comment
Please, Sign In to add comment