Fold to F Bet

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

Fold to F Bet

Postby Stevey » Wed Oct 20, 2010 5:54 am

Hello!

I would like to query a basic stat like "Fold to F Bet" from the database (PT3) with a certain SQL Statement for a given Playername.
I had a look into the Database Schema, but I am kind of lost.

The stat comes from
(cnt_f_bet_def_action_fold / cnt_f_bet_def_opp) * 100

which is

cnt_f_bet_def_action_fold
sum(if[holdem_hand_player_detail.amt_f_bet_facing > 0 AND (lookup_actions_f.action SIMILAR TO '(F|XF)%'), 1, 0])

cnt_f_bet_def_opp
sum(if[holdem_hand_player_detail.amt_f_bet_facing > 0, 1, 0])

How can I specify a player here?

Thank you,

Steveyy
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am

Re: Fold to F Bet

Postby kraada » Wed Oct 20, 2010 8:52 am

You can do this in a custom report using this filter:

holdem_hand_player_statistics.id_hand in (SELECT hhps.id_hand from holdem_hand_player_statistics hhps, player p where p.id_player = hhps.id_player and hhps.flg_f_bet and p.player_name = 'Villian Goes Here')

Replace Villain Goes Here with the villian's name you want, but you do need 's around it. Run your report for yourself and you'll see only data from when that player bet and you were dealt into the hand.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Fold to F Bet

Postby Stevey » Wed Oct 20, 2010 9:58 am

Hi kraada,

thx again for your quick response!

What exactly do you mean by "custom report", is that some functionality of PT3?

Usually I would test the SQL's in my postgres surrounding.
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am

Re: Fold to F Bet

Postby Stevey » Wed Oct 20, 2010 10:35 am

This custom report was known to me, but I didn't remember the name. It is pretty useful, but did not help me in this case.

I want to get the Fold to FBet statistics for a certain player. I'll try out the SQL you provided and report back :)
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am

Re: Fold to F Bet

Postby kraada » Wed Oct 20, 2010 10:39 am

You make a custom report by using the Reports tab in PT3; for more on creating custom reports and the features available there, please see the Tutorial: Using Custom Statistics and Reports.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Fold to F Bet

Postby WhiteRider » Wed Oct 20, 2010 11:32 am

If you just want to see stats for a certain player you can click on their name in the Player List on the left-hand side. You can add any stats you like to the reports so that you can see those stats for each player.

Tutorial: Configure Built-in Reports
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK

Re: Fold to F Bet

Postby Stevey » Wed Oct 20, 2010 11:57 am

That would definitively be comfortable, thanks!

I have been working on those SQLs(?) and transformed them, so that I could use them:

; cnt_f_bet_def_action_fold
; sum(if[holdem_hand_player_detail.amt_f_bet_facing > 0 AND (lookup_actions_f.action SIMILAR TO '(F|XF)%'), 1, 0])

; cnt_f_bet_def_opp
; sum(if[holdem_hand_player_detail.amt_f_bet_facing > 0, 1, 0])

- - -

SELECT COUNT(hhpd.amt_f_bet_facing) FROM holdem_hand_player_detail hhpd, lookup_actions la, player p WHERE hhpd.amt_f_bet_facing > 0 AND la.action SIMILAR TO '(F|XF)%' AND hhpd.id_player = p.id_player AND p.player_name = 'player name comes here'

SELECT COUNT(hhpd.amt_f_bet_facing) FROM holdem_hand_player_detail hhpd WHERE hhpd.amt_f_bet_facing > 0

Do you know what the 0, 1, 0 at the end means? "...mt_f_bet_facing > 0, 1, 0])" Why not just ">0"?
I could not find "cnt_f_bet_def_opp" in the tables faq, but PT showed it to me in "configure stats".... how can I access this?
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am

Re: Fold to F Bet

Postby kraada » Wed Oct 20, 2010 1:00 pm

COUNT() is very slow in PostgreSQL - so what we do is use a CASE() statement to sum times when it is true.

So what is happening here is that the if statement is saying what is true, and then what to do when that happens - in the ", 1, 0" cases it adds 1 when it is true and adds 0 when it is false.

If you wish to see the exact queries that PT3 is using against the database, you can enable logging by starting PT3 from the Logging Enabled link in the Start Menu, then look at the PokerTracker.log text file (located in C:\Program Files (x86)\PokerTracker 3\) and that will contain all queries as they're run against the database.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Fold to F Bet

Postby Stevey » Wed Oct 20, 2010 1:12 pm

That's amazing, thanks!
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am

Re: Fold to F Bet

Postby Stevey » Thu Oct 21, 2010 1:42 am

This Method using Custom Stats and looking up the SQL Queries works perfectly. Thanks alot u2!
Stevey
 
Posts: 13
Joined: Thu Jun 17, 2010 10:53 am


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

Who is online

Users browsing this forum: No registered users and 3 guests