stat formulation

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

stat formulation

Postby raph156 » Sat Oct 01, 2011 12:05 pm

Hi,
Whats wrong?
sum( if[ (holdem_hand_player_statistics.id_holecard = 1) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%') ,if [ (holdem_hand_player_statistics.id_holecard = 26) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%') , 1, 0]])
Thanks for help
raph156
 
Posts: 159
Joined: Tue Feb 09, 2010 3:22 pm

Re: stat formulation

Postby raph156 » Sat Oct 01, 2011 12:53 pm

i tryed thise too
sum( if[ (holdem_hand_player_statistics.id_holecard = 1) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.enum_p_3bet_action='C' , if[ (holdem_hand_player_statistics.id_holecard = 26) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.enum_p_3bet_action='C' ,1, 0]])
raph156
 
Posts: 159
Joined: Tue Feb 09, 2010 3:22 pm

Re: stat formulation

Postby kraada » Sat Oct 01, 2011 12:56 pm

A few things:

(1) You can't use "if [" it has to be "if[".
(2) You didn't have an else clause for the first if[] statement.

This validates:

sum( if[ (holdem_hand_player_statistics.id_holecard = 1) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%'), if[ (holdem_hand_player_statistics.id_holecard = 26) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%') , 1, 0] , 0])

You also might want to add parentheses around your OR statements to make sure they group the way that you intend as (A AND B) OR C is not the same as A AND (B OR C).
kraada
Moderator
 
Posts: 54430
Joined: Wed Mar 05, 2008 2:32 am
Location: NY

Re: stat formulation

Postby raph156 » Sat Oct 01, 2011 1:18 pm

Thise one is valide, that work too?
sum( if[ (holdem_hand_player_statistics.id_holecard = 1) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%'),1 , if[(holdem_hand_player_statistics.id_holecard = 26) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%') ,1, 0]])
Thanks for help
raph156
 
Posts: 159
Joined: Tue Feb 09, 2010 3:22 pm

Re: stat formulation

Postby kraada » Sat Oct 01, 2011 1:29 pm

Yes, though as I look at it you can simplify considerably.

This will do the same thing and is much easier to comprehend:

sum( if[ (holdem_hand_player_statistics.id_holecard = 1 OR holdem_hand_player_statistics.id_holecard = 26) AND holdem_hand_player_detail.amt_p_raise_made>0 OR holdem_hand_player_statistics.flg_p_face_raise AND (lookup_actions_p.action SIMILAR TO '(C|XC)%') OR (lookup_actions_p.action SIMILAR TO '(R|XR)%'), 1 , 0])
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