Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT events.event_key,
- events.id game_id,
- CONVERT_TZ(events.start_date_time, 'GMT','America/New_York') as time,
- dn_home.abbreviation as home,
- dn_home.entity_id as home_id,
- dn_away.abbreviation as away,
- dn_away.entity_id as away_id,
- events.round_number wk
- FROM
- events
- JOIN events_sub_seasons ess ON ess.event_id = events.id
- JOIN sub_seasons ss ON ss.id = ess.sub_season_id
- JOIN affiliations_events ae ON ae.event_id = events.id
- JOIN affiliations a_league ON a_league.id = ae.affiliation_id
- JOIN participants_events pe_home ON pe_home.event_id = events.id
- JOIN participants_events pe_away ON pe_away.event_id = events.id
- JOIN teams t ON t.id = pe_home.participant_id
- JOIN display_names dn_home ON pe_home.participant_id = dn_home.entity_id
- JOIN display_names dn_away ON pe_away.participant_id = dn_away.entity_id
- WHERE
- ss.sub_season_key = '2011_season_regular'
- AND a_league.affiliation_key = 'l.nfl.com'
- AND a_league.affiliation_type = 'league'
- AND pe_home.alignment = 'home'
- AND pe_home.participant_type = 'teams'
- AND pe_away.alignment = 'away'
- AND pe_away.participant_type = 'teams'
- AND dn_home.entity_type = 'teams'
- AND dn_away.entity_type = 'teams'
Add Comment
Please, Sign In to add comment