- Code: Select all
select distinct first_value(thps.amt_before) over (partition by thps.id_tourney order by thps.date_played)
from tourney_hand_player_statistics as thps
join tourney_summary as ts on ts.id_tourney = thps.id_tourney
where thps.flg_hero
and ts.tourney_no = tourney_summary.tourney_no
i took this expression and created a column "starting_stack" based on it. using this column, i created the stat. it works quite reliably (even though i don't fully understand how), but the main issue is that the stat based on this query (as well as the original report) runs quite slowly. is there a way to create a starting stack stat more simply?