Sum of Hands Played at certain blind level

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

Sum of Hands Played at certain blind level

Postby Th0rgal » Wed Mar 11, 2009 9:09 am

Hi There,

I am trying to build stats for different blind levels and for them to show up in the HUD

Lets say for Level one and two where Big blinds on FT sit and go's are 20 and 40

VPiPL12
(cnt_vpip_l12 / cnt_hands_l12) * 100

cnt_vpip_l12
sum(if[tourney_holdem_hand_player_statistics.flg_vpip and
((tourney_holdem_blinds.amt_bb = 20 and tourney_holdem_blinds.amt_bb = 40)), 1, 0])

cnt_hands_l12
sum(if[tourney_holdem_hand_player_statistics.id_hand and
((tourney_holdem_blinds.amt_bb = 20 and tourney_holdem_blinds.amt_bb = 40)), 1, 0])

Unfortunately cnt_hands_l12 tells me it is not a valid SQL statment

Can you point me in the right direction? or is this not possible?

Cheers,
Thorgal
Th0rgal
 
Posts: 90
Joined: Sat Apr 19, 2008 7:45 am

Re: Sum of Hands Played at certain blind level

Postby kraada » Wed Mar 11, 2009 10:09 am

This should work; id_hand is a number, not a true/false, so you can't use it like that. For the denominator you can just use:

sum(if[tourney_holdem_blinds.amt_sb = 20 and tourney_holdem_blinds.amt_bb = 40, 1, 0])

The id_hand used in counting the total hands is just to give you something to count. Here what we're counting is how many times the sb = 20 and bb = 40.

Incidentally you had a typo in both columns: you want amt_sb to be 20, as there are no cases where amt_bb = 20 and amt_bb = 40 in the same hand.

if you want the BB to be either 20 or 40, use OR, not AND.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Sum of Hands Played at certain blind level

Postby Th0rgal » Wed Mar 11, 2009 10:30 am

All sorted!

Thank you,
Thorgal
Th0rgal
 
Posts: 90
Joined: Sat Apr 19, 2008 7:45 am

Re: Sum of Hands Played at certain blind level

Postby TheLuigi » Mon Apr 09, 2012 8:39 am

I have problem with counting hands played in certain blind level. I have made column:

sum(if[tourney_holdem_hand_player_statistics.id_hand > 0 and tourney_holdem_blinds.amt_bb=60, 1, 0])

and stat directly from this. The problem is that when I run report, it doesn't remove any hands from hands played all together, there is same number. The situation doesn't change by changing operator or bb amount. I tried it also in PT4, but that says invalid SQL statement.
TheLuigi
 
Posts: 15
Joined: Tue Jul 15, 2008 5:02 pm

Re: Sum of Hands Played at certain blind level

Postby kraada » Mon Apr 09, 2012 9:39 am

I'm a bit confused - when you use a report you get the same results using a stat with this expression:


sum(if[tourney_holdem_hand_player_statistics.id_hand > 0 and tourney_holdem_blinds.amt_bb=60, 1, 0])

as this expression:


sum(if[tourney_holdem_hand_player_statistics.id_hand > 0 and tourney_holdem_blinds.amt_bb=100, 1, 0])?

In PT4 things have changed some - you'd want to remove "holdem" (so it becomes tourney_hand_player_statistics and tourney_blinds) and I think that's all you'd need to do.
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: Sum of Hands Played at certain blind level

Postby TheLuigi » Mon Apr 09, 2012 10:16 am

The problem was the format expression. Few days ago I tried to build VPIP for different stages of tourney, but it didn't work out. Then I noticed that problem is in hands-side, but didn't find the reason today. It's just so unintuative that stat value is sometimes based on format expression, that didn't remember it this time. Everything is ok again.
TheLuigi
 
Posts: 15
Joined: Tue Jul 15, 2008 5:02 pm

Re: Sum of Hands Played at certain blind level

Postby kraada » Mon Apr 09, 2012 11:53 am

Understood - I've done that myself a few times. It's one reason we simplified the interface in PT4.
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 6 guests