The statement is not valid SQL

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

The statement is not valid SQL

Postby Drignatio » Sun Feb 20, 2011 8:04 pm

My friend who is a programmer for his job (went to college for it too) and I tried to make a few new columns. The first one is basically just when the CO or BTN open raise steal attempt and either or both of the blinds call the open raise and do not 3b.

It looks perfectly correct but when I enter it into the software it tells me "The statement is not valid SQL" so there must be a typo or something somewhere where I'm not seeing? Also, is there a way to write this to say that just ONE of the blinds call? and a way to write it with BOTH of the blind calling?

Flag_Steal_And_Blind(s)_Calls:

holdem_hand_player_statistics.flg_steal_att and
not(holdem_hand_player_statistics.flg_blind_s) and
not(holdem_hand_player_statistics.flg_p_3bet_def_opp OR holdem-hand_player_statistics.flg_p_4bet_def_opp)


The other two columns we created to attempt a % fold to turn checkraise when making a delayed cbet. Same error message. What is the issue?


Cnt_Steal_Delay_Cbet_Fold_To_CheckRaise:

Sum
(
IF
[
Flag_Steal_And_Blind(s)_Calls and
not(holdem_hand_player_statistics.flg_f_cbet) and
not(holdem_hand_player_statistics.flg_f_cbet_def_opp) and
not(holdem_hand_player_statistics.flg_t_donk_def_opp) and
not(holdem_hand_player_statistics.flg_t_cbet) and
holdem_hand_player_statistics.flg_f_face_raise and
holdem_hand_player_detail.flg_f_has_position and
holdem_hand_player_statistics.enum_folded = 'F', 1, 0

]
)

Cnt_Steal_Delay_Cbet_Faces_Check_Raise:

Sum
(
IF
[
Flag_Steal_And_Blind(s)_Calls and
not(holdem_hand_player_statistics.flg_f_cbet) and
not(holdem_hand_player_statistics.flg_f_cbet_def_opp) and
not(holdem_hand_player_statistics.flg_t_donk_def_opp) and
not(holdem_hand_player_statistics.flg_t_cbet) and
holdem_hand_player_statistics.flg_f_face_raise and
holdem_hand_player_detail.flg_f_has_position, 1, 0

]
)
Drignatio
 
Posts: 16
Joined: Mon May 26, 2008 1:28 am
Location: Winnipeg, MB

Re: The statement is not valid SQL

Postby WhiteRider » Mon Feb 21, 2011 5:35 am

You can't use "Flag_Steal_And_Blind(s)_Calls" as if it was a variable.
You will need to include the whole expression within your other stats. I guess you probably have done that, and the problem seems to be in:

holdem_hand_player_detail.flg_f_has_position

..although I can't see why. Deleting that and inserting it again via the blue insert link works.

You also have a - instead of _ in "holdem-hand_player_statistics.flg_p_4bet_def_opp".

This is fine, for instance:

sum( if[ holdem_hand_player_statistics.flg_steal_att and
not(holdem_hand_player_statistics.flg_blind_s) and
not(holdem_hand_player_statistics.flg_p_3bet_def_opp OR holdem_hand_player_statistics.flg_p_4bet_def_opp) and not(holdem_hand_player_statistics.flg_f_cbet) and
not(holdem_hand_player_statistics.flg_f_cbet_def_opp) and
not(holdem_hand_player_statistics.flg_t_donk_def_opp) and
not(holdem_hand_player_statistics.flg_t_cbet) and
holdem_hand_player_statistics.flg_f_face_raise and holdem_hand_player_detail.flg_f_has_position and
holdem_hand_player_statistics.enum_folded = 'F', 1 , 0 ] )


The "not(holdem_hand_player_statistics.flg_f_cbet_def_opp)" part is not necessary, though - if you were the preflop aggressor then you can't face a c-bet as only you can make a c-bet.
If you want to check for the flop being checked through then this is OK (when you have position):
ot(holdem_hand_player_statistics.flg_f_cbet) and holdem_hand_player_statistics.flg_f_cbet_opp

Alternatively, you can check for the flop being checked through by the action string being only 'X' (if you only check then you didn't face any action):
lookup_actions_f.action = 'X'

This part of your expression:
holdem_hand_player_statistics.flg_f_face_raise and
holdem_hand_player_detail.flg_f_has_position and
holdem_hand_player_statistics.enum_folded = 'F'
..refers to the flop, but it sounds like that should be _t_ and 'T'?

If the action is flop being checked through then betting the turn and facing a [check] raise then you'll probably want to check for:
holdem_hand_player_statistics.flg_t_bet and holdem_hand_player_statistics.flg_t_face_raise and holdem_hand_player_statistics.flg_t_fold

You don't have an opportunity to c-bet the turn in this case (because you didn't c-bet the flop).
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