Multi street bet patterns

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

Multi street bet patterns

Postby JFFB » Sun Mar 14, 2010 12:10 am

I've generated a Johnny Chan "XC flop, bet turn" stat as follows:
sum(if[if[lookup_actions_f.action LIKE 'XC', 1, 0] > 0 AND holdem_hand_player_statistics.flg_t_saw AND substring(lookup_actions_t.action from 1 for 1)='B', 1, 0])

I've tried to extend this to number of times a flop XC is followed by a turn XC

sum(if[if[lookup_actions_f.action LIKE 'XC', 1, 0] > 0 AND holdem_hand_player_statistics.flg_t_saw AND if[lookup_actions_t.action LIKE 'XC', 1, 0] > 0])

I have violated mysterious SQL rules in the above expression. Mutliple lookups prohibited?

I interested in a methodology to generate stats on multi-street bet patterns:

XC, B
XC, XC
XC,XC,B
XC, XC, X
Bet, Bet, Bet
Bet, X, Bet

I'm dead in the water so far. I understand the denominators will be tricky and I'll certainly not capture 100% of actions. It might provide insight against certain ABC moves. Thoughts & help appreciated.
JFFB
 
Posts: 2
Joined: Tue Jan 27, 2009 12:01 pm

Re: Multi street bet patterns

Postby kraada » Sun Mar 14, 2010 8:41 am

You can use multiple lookups, but you cannot use multiple if[] statements in that fashion.

This: sum(if[if[lookup_actions_f.action LIKE 'XC', 1, 0] > 0 AND holdem_hand_player_statistics.flg_t_saw AND substring(lookup_actions_t.action from 1 for 1)='B', 1, 0])

Should be: sum(if[lookup_actions_f.action LIKE 'XC' AND holdem_hand_player_statistics.flg_t_saw AND substring(lookup_actions_t.action from 1 for 1)='B', 1, 0])

The if[] statement is if[condition, true, false] where condition is some statement that is either true or false, "true" is what to do if it is true (in the above case, add one), "false" is what to do if false (in the above case, add 0). Your second statement needs to be changed in a similar fashion as well.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Multi street bet patterns

Postby JFFB » Sun Mar 14, 2010 9:46 am

Thank you for the insight. I was off the trail because the first expression with nested if statements is actually checking as valid SQL and has been working.
JFFB
 
Posts: 2
Joined: Tue Jan 27, 2009 12:01 pm

Re: Multi street bet patterns

Postby WhiteRider » Sun Mar 14, 2010 3:22 pm

Just a couple of points to clarify about comparing strings with LIKE.
(You don't need to change anything else, this is just for information.)

lookup_actions_t.action LIKE 'XC'

LIKE 'XC' is only true if the string is EXACTLY 'XC'. It will not match 'XCC' for instance.

1. If you want to check for exactly XC then you can use =.
lookup_actions_t.action = 'XC'
..is the same.

2. If you want to check for check/call followed by any other action then you need to add a % (which will match any zero or more characters).
lookup_actions_t.action LIKE 'XC%'

For instance, instead of:
substring(lookup_actions_t.action from 1 for 1)='B'
.. you can do:
lookup_actions_t.action LIKE 'B'

For more about this see the Tutorial - Custom Reports and Statistics.
WhiteRider
Moderator
 
Posts: 54025
Joined: Sat Jan 19, 2008 7:06 pm
Location: UK


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

Who is online

Users browsing this forum: No registered users and 1 guest