Adding an if condition to a sum

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

Adding an if condition to a sum

Postby lkastel » Wed Sep 08, 2010 9:01 pm

For example, say I want to make a column that holds the number of times the player has raised the flop in hands with antes.

I create a duplicate of cnt_f_raise, and change the expression from this:

sum(tourney_holdem_hand_player_statistics.cnt_f_raise)

to this

sum(if[tourney_holdem_hand_player_detail.amt_ante > 0, tourney_holdem_hand_player_statistics.cnt_f_raise, 0])

Will that give the right result?
lkastel
 
Posts: 19
Joined: Tue Sep 07, 2010 11:21 pm

Re: Adding an if condition to a sum

Postby WhiteRider » Thu Sep 09, 2010 4:54 am

Exactly right - good work!
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 0 guests