turbot/nba

Query: nba_team_performance_over_time

Usage

powerpipe query nba.query.nba_team_performance_over_time

SQL

select
gs.season,
sum(case when g.wl_home = 'W' then 1 else 0 end + case when g.wl_away = 'W' then 1 else 0 end) as total_wins
from
game g
join game_summary gs on g.game_id = gs.game_id
where
g.team_id_home = $1 or g.team_id_away = $1
group by
gs.season
order by
total_wins;

Dashboards

The query is used in the dashboards: