Discuss how to create custom stats, reports and HUD profiles and share your creations.
Moderators: WhiteRider, kraada, Flag_Hippo, morny, Moderators
by BillGatesIII » Sun Sep 08, 2013 8:54 am
This one might be faster.
- Code: Select all
CREATE OR REPLACE FUNCTION current_position(tourney_hand_player_statistics)
RETURNS bigint AS
$BODY$
with last_hand as (
select id_hand
from tourney_hand_summary
where id_tourney = $1.id_tourney
order by id_hand desc
limit 1)
select all_players.cur_pos
from (select thps.id_player, id_hand, row_number() over (order by (thps.amt_before - thps.amt_blind - thps.amt_ante + thps.amt_won) desc) as cur_pos
from tourney_hand_player_statistics thps
where thps.id_hand = (select id_hand from last_hand)) as all_players
where all_players.id_player = $1.id_player
and all_players.id_hand = (select id_hand from last_hand);
$BODY$
LANGUAGE sql STABLE
COST 100;
ALTER FUNCTION current_position(tourney_hand_player_statistics)
OWNER TO postgres;
-
BillGatesIII
-
- Posts: 740
- Joined: Fri Dec 16, 2011 6:50 pm
by pt4pt4pt4 » Mon Jan 13, 2014 5:08 am
Never got back to this but did use Position only for HERO which works great ( all I need really)
Using this:
min(tourney_hand_player_statistics.current_position)
whatever it was
-
pt4pt4pt4
-
- Posts: 1097
- Joined: Fri Feb 03, 2012 12:17 am
-
Return to Custom Stats, Reports and HUD Profiles
Users browsing this forum: No registered users and 17 guests