Possible typo in doucmentation and SQL appraisal

Forum for users that want to write their own custom queries against the PT database either via the Structured Query Language (SQL) or using the PT3 custom stats/reports interface.

Moderator: Moderators

Possible typo in doucmentation and SQL appraisal

Postby tty1 » Sun Nov 22, 2009 7:47 pm

Hi there,

Just wondering if anybody else has noticed a typo on page 32 of the database schema documentation? There seems to be two entries for an attribute "flg_showdown" in "tourney_holdem_player_statistics". The version I've got is from February 10, 2009.

On a related note, I'm writing a query to calculate the PFR for players with more than 50 hands played. I was wondering what might be the best way to do this? Here is what I have so far.

Code: Select all
CREATE TABLE player_hand_count AS
       SELECT id_player, sum (cnt_hands) AS total_hands
              FROM holdem_table_session_summary
              WHERE id_limit = 1
              GROUP BY id_player;

CREATE TABLE threshold_players AS
       SELECT id_player
       FROM player_hand_count
       WHERE total_hands > 50;

CREATE TABLE pfr AS
       SELECT a.id_player, ((times_raised_pf / total_hands::float) * 100) AS pfr
       FROM
            (SELECT aa.id_player, count(id_hand) AS times_raised_pf
                   FROM holdem_hand_player_statistics aa
                   WHERE cnt_p_raise > 0
                   AND id_player IN (SELECT id_player from threshold_players)
                   GROUP BY aa.id_player) a
            INNER JOIN player_hand_count b
                  ON a.id_player = b.id_player;


Cheers.
tty1
 
Posts: 6
Joined: Sun Nov 22, 2009 7:18 pm

Re: Possible typo in doucmentation and SQL appraisal

Postby kraada » Sun Nov 22, 2009 8:19 pm

You are correct; that is an error. The first "flg_showdown" should be "flg_blind_k".

With regards to your report, you can do this in the PT3 custom reports a lot easier.

Go to the Reports tab in PT3, choose Holdem Cash Player Statistics as the section, then add the stats Player and PFR. Then click Filters and add the filter:
#Hands# > 50

Save the filter, uncheck "Filter on active player", then save and run the report and you'll see all the players' names with their PFR for players with more than 50 hands.

If you want to see the SQL used for that query, you can either grab it most easily by checking your pg_log files.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY


Return to Custom Stats, Reports, and SQL [Read Only]

Who is online

Users browsing this forum: No registered users and 0 guests