Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. SELECT s1.scope, seasons.season_key as season, ss.sub_season_key,
  2. dn_player.first_name, dn_player.last_name, positions.abbreviation,
  3. p.person_key, p.id as player_id, dn_team.full_name as team_name, dn_team.abbreviation as team_abbreviation, t.team_key,
  4. s.*
  5.  
  6. FROM persons p
  7. JOIN stats s1 ON (s1.stat_holder_id = p.id AND s1.stat_repository_type = 'ice_hockey_offensive_stats')
  8. JOIN ice_hockey_offensive_stats s ON s1.stat_repository_id = s.id
  9. JOIN teams t ON s1.stat_membership_id = t.id
  10. JOIN sub_seasons ss ON s1.stat_coverage_id = ss.id
  11. JOIN seasons ON seasons.id = ss.season_id
  12. JOIN affiliations a ON (a.id = seasons.league_id AND a.affiliation_key = 'l.nhl.com')
  13. JOIN display_names dn_player ON s1.stat_holder_id = dn_player.entity_id
  14. JOIN display_names dn_team ON s1.stat_membership_id = dn_team.entity_id
  15.  
  16. JOIN person_phases pp ON (p.id = pp.person_id)
  17. JOIN positions ON pp.regular_position_id = positions.id
  18. JOIN publishers AS pub ON (pub.id = t.publisher_id AND pub.publisher_key = 'stats.com')
  19.  
  20. WHERE s1.stat_holder_type = 'persons' AND s1.stat_coverage_type = 'sub_seasons' AND dn_player.entity_type = 'persons' AND dn_team.entity_type = 'teams' AND s1.scope IS NULL AND t.team_key = 'l.nhl.com-t.18'
  21. ORDER BY seasons.season_key DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement