Page 1 of 1

Custom column - not valid SQL. Help!

PostPosted: Fri Jun 22, 2012 10:21 pm
by benharvey
Hey guys I am trying to create a custom column for a stat that varies by preflop effective stack size. This is my column for cnt_f_raise_0_to_8bb (based on cnt_f_raise). I can't save it as PT4 says that it isn't valid SQL. What am I missing???

I have other stats that have similar queries in them for effective stack size and they work fine.

sum(if[tourney_hand_player_statistics.cnt_f_raise AND (tourney_hand_summary.amt_p_effective_stack / tourney_blinds.amt_bb) < 8, 1, 0])

Thanks

Re: Custom column - not valid SQL. Help!

PostPosted: Fri Jun 22, 2012 11:27 pm
by benharvey
ok so this works but I'm not sure why as I'm new to this stuff, I though the first if statement would need the ", 1, 0"

sum(if[if[tourney_hand_player_statistics.cnt_f_raise > 0] AND (tourney_hand_summary.amt_p_effective_stack / tourney_blinds.amt_bb) < 8, 1, 0])

This is for a flop raise when effective stacks are <8bb (I know this won't happen often in reality but it's the stat I'm more interested in)

Re: Custom column - not valid SQL. Help!

PostPosted: Sat Jun 23, 2012 4:55 am
by WhiteRider
You're nearly there, but you don't need to nest IF statements in this case, you can just use:

sum(if[tourney_hand_player_statistics.cnt_f_raise > 0 AND (tourney_hand_summary.amt_p_effective_stack / tourney_blinds.amt_bb) < 8, 1, 0])

(You do mean effective stacks preflop, don't you, since you're using "amt_p_effective_stack"?)

Re: Custom column - not valid SQL. Help!

PostPosted: Sat Jun 23, 2012 6:03 am
by benharvey
ah ok thanks.

Yes I do mean preflop :)