Housekeeping problem

https://staging.pokertracker.com/forums/
https://staging.pokertracker.com/forums/viewtopic.php?f=16&t=10991
There were errors during the housekeeping process:
Unable to prepare query: INSERT INTO holdem_cache SELECT holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players, (count(holdem_hand_player_statistics.id_hand)),
(sum((case when(holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b OR holdem_hand_player_statistics.flg_blind_s OR holdem_hand_player_statistics.flg_blind_db OR holdem_hand_player_statistics.flg_blind_ds) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b and holdem_hand_player_statistics.flg_blind_s = false) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end) )),
(sum((case when(holdem_hand_player_statistics.flg_sb_steal_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_bb_steal_fold) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_att) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_p_limp = false AND holdem_hand_player_statistics.flg_p_ccall = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand AND holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_saw) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_call)),
(sum((case when(holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check AND (holdem_hand_player_statistics.cnt_f_raise > 0 OR holdem_hand_player_statistics.cnt_f_call > 0 OR holdem_hand_player_statistics.flg_f_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_f_raise)),
(sum(holdem_hand_player_statistics.cnt_f_call)),
(sum((case when(holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check AND (holdem_hand_player_statistics.cnt_t_raise > 0 OR holdem_hand_player_statistics.cnt_t_call > 0 OR holdem_hand_player_statistics.flg_t_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_call)),
(sum((case when(holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check AND (holdem_hand_player_statistics.cnt_r_raise > 0 OR holdem_hand_player_statistics.cnt_r_call > 0 OR holdem_hand_player_statistics.flg_r_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_call)),
(sum((case when(holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won)),
(sum( (case when(holdem_hand_player_statistics.flg_won_hand) then holdem_hand_summary.amt_rake else 0 end) )),
(sum(holdem_hand_summary.amt_mgr)),
(sum(holdem_hand_player_detail.amt_blind)),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won * 1.0 / (holdem_limit.amt_bb *holdem_limit.val_nlpl_mult))),
(sum( (case when(holdem_hand_player_statistics.flg_p_first_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum( (case when( holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp AND holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_opp) then 1 else 0 end))),
(count(distinct holdem_hand_player_statistics.id_session)),
(count( (SELECT (case when(sum(hhps_s.amt_won) > 0) then 1 else 0 end) FROM holdem_hand_player_statistics hhps_s WHERE id_session = holdem_hand_player_statistics.id_session) )),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.amt_rake > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.cnt_players_f > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F' ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp ) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 3) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 3) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 3) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_fold AND holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))
),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))
),
(sum ( (case when( flg_f_bet AND holdem_hand_player_statistics.flg_f_face_raise AND (holdem_hand_player_detail.val_f_raise_aggressor_pos > holdem_hand_player_statistics.position) AND (holdem_hand_player_statistics.cnt_f_call = 0) AND (holdem_hand_player_statistics.cnt_f_raise = 0)) then 1 else 0 end) )),
(sum ( (case when( flg_f_bet AND holdem_hand_player_statistics.flg_f_face_raise AND (holdem_hand_player_detail.val_f_raise_aggressor_pos > holdem_hand_player_statistics.position)) then 1 else 0 end) )),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.position = 7) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 7) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 7) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(tourney_holdem_hand_summary.amt_p_effective_stack)
FROM
holdem_hand_player_statistics,
holdem_hand_summary,
holdem_hand_player_detail,
holdem_limit,
tourney_holdem_hand_summary
WHERE (holdem_hand_summary.id_hand = holdem_hand_player_statistics.id_hand)
AND (holdem_hand_player_statistics.id_hand = holdem_hand_player_detail.id_hand AND holdem_hand_player_statistics.id_player = holdem_hand_player_detail.id_player)
AND (holdem_limit.id_limit = holdem_hand_player_statistics.id_limit)
AND (holdem_hand_summary.id_hand = holdem_hand_player_detail.id_hand)
AND (holdem_limit.id_limit = holdem_hand_summary.id_limit)
AND (holdem_hand_player_statistics.id_player = $1)
GROUP BY holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players; Reason: Fatal Error (ERROR: column "tourney_holdem_hand_summary.amt_p_effective_stack" must appear in the GROUP BY clause or be used in an aggregate function )
Unable to prepare query: INSERT INTO holdem_cache SELECT holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players, (count(holdem_hand_player_statistics.id_hand)),
(sum((case when(holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b OR holdem_hand_player_statistics.flg_blind_s OR holdem_hand_player_statistics.flg_blind_db OR holdem_hand_player_statistics.flg_blind_ds) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b and holdem_hand_player_statistics.flg_blind_s = false) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end) )),
(sum((case when(holdem_hand_player_statistics.flg_sb_steal_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_bb_steal_fold) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_att) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_p_limp = false AND holdem_hand_player_statistics.flg_p_ccall = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand AND holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_saw) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_call)),
(sum((case when(holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check AND (holdem_hand_player_statistics.cnt_f_raise > 0 OR holdem_hand_player_statistics.cnt_f_call > 0 OR holdem_hand_player_statistics.flg_f_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_f_raise)),
(sum(holdem_hand_player_statistics.cnt_f_call)),
(sum((case when(holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check AND (holdem_hand_player_statistics.cnt_t_raise > 0 OR holdem_hand_player_statistics.cnt_t_call > 0 OR holdem_hand_player_statistics.flg_t_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_call)),
(sum((case when(holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check AND (holdem_hand_player_statistics.cnt_r_raise > 0 OR holdem_hand_player_statistics.cnt_r_call > 0 OR holdem_hand_player_statistics.flg_r_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_call)),
(sum((case when(holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won)),
(sum( (case when(holdem_hand_player_statistics.flg_won_hand) then holdem_hand_summary.amt_rake else 0 end) )),
(sum(holdem_hand_summary.amt_mgr)),
(sum(holdem_hand_player_detail.amt_blind)),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won * 1.0 / (holdem_limit.amt_bb *holdem_limit.val_nlpl_mult))),
(sum( (case when(holdem_hand_player_statistics.flg_p_first_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum( (case when( holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp AND holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_opp) then 1 else 0 end))),
(count(distinct holdem_hand_player_statistics.id_session)),
(count( (SELECT (case when(sum(hhps_s.amt_won) > 0) then 1 else 0 end) FROM holdem_hand_player_statistics hhps_s WHERE (holdem_table_session_summary.id_session) = holdem_hand_player_statistics.id_session) )),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.amt_rake > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.cnt_players_f > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp AND holdem_hand_player_statistics.enum_p_3bet_action='R' ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 1 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 2 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 3 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_f_3bet_def_opp ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_squeeze_opp ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_squeeze ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F' ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp ) then 1 else 0 end))),
(holdem_table_session_summary.id_session),
(holdem_table_session_summary.id_session),
(sum((case when(holdem_hand_player_statistics.cnt_f_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_f_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sqrt(sum( (holdem_hand_player_statistics.amt_won * 1.0 / (holdem_limit.amt_bb *holdem_limit.val_nlpl_mult))^2 ))),
(sqrt(count(holdem_hand_player_statistics.id_hand))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(holdem_hand_player_detail.amt_before),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b and holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end) )),
(sum( (case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end) )),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end) )),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 3 ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s
AND holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b
AND holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.position = 9) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_opp AND holdem_hand_player_statistics.position = 9) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_opp AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet AND NOT(holdem_hand_player_statistics.flg_t_saw) AND NOT(holdem_hand_player_statistics.flg_f_face_raise)) then 1 else 0 end))
),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='C') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_t_cbet_action='C') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_detail.flg_f_open_opp AND NOT holdem_hand_player_statistics.flg_f_cbet_opp
AND (holdem_hand_player_detail.val_p_raise_aggressor_pos (sum((case when( holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_detail.flg_f_open AND NOT holdem_hand_player_statistics.flg_f_cbet_opp
AND (holdem_hand_player_detail.val_p_raise_aggressor_pos (sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='R') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_t_cbet_action='R') then 1 else 0 end))),
(sum( (case when(holdem_hand_summary.amt_rake>0.4) then (case when(holdem_hand_summary.amt_rake=3) then 2 else 1 end) else 0 end) )),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_t_cbet_action='F' ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_t_cbet_def_opp ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_t_cbet_def_opp ) then 1 else 0 end))),
((case when( (sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_f_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))) else 0 end)),
((case when( (sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_r_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))) else 0 end)),
((case when( (sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_t_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))) else 0 end))
FROM
holdem_hand_player_statistics,
holdem_hand_summary,
holdem_hand_player_detail,
holdem_limit,
holdem_table_session_summary
WHERE (holdem_hand_summary.id_hand = holdem_hand_player_statistics.id_hand)
AND (holdem_hand_player_statistics.id_hand = holdem_hand_player_detail.id_hand AND holdem_hand_player_statistics.id_player = holdem_hand_player_detail.id_player)
AND (holdem_limit.id_limit = holdem_hand_player_statistics.id_limit)
AND (holdem_hand_player_statistics.id_session = holdem_table_session_summary.id_session)
AND (holdem_hand_summary.id_hand = holdem_hand_player_detail.id_hand)
AND (holdem_limit.id_limit = holdem_hand_summary.id_limit)
AND (holdem_limit.id_limit = holdem_table_session_summary.id_limit)
AND (holdem_hand_player_statistics.id_player = $1)
GROUP BY holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players; Reason: Fatal Error (ERROR: column "holdem_table_session_summary.id_session" must appear in the GROUP BY clause or be used in an aggregate function )
Unable to prepare query: INSERT INTO holdem_cache SELECT holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players, (count(holdem_hand_player_statistics.id_hand)),
(sum((case when(holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b OR holdem_hand_player_statistics.flg_blind_s OR holdem_hand_player_statistics.flg_blind_db OR holdem_hand_player_statistics.flg_blind_ds) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b and holdem_hand_player_statistics.flg_blind_s = false) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end) )),
(sum((case when(holdem_hand_player_statistics.flg_sb_steal_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_bb_steal_fold) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_b) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_att) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_steal_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.flg_p_limp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_p_open = false AND holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_p_limp = false AND holdem_hand_player_statistics.flg_p_ccall = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_won_hand AND holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_saw) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_saw) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_p_call)),
(sum((case when(holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_check AND (holdem_hand_player_statistics.cnt_f_raise > 0 OR holdem_hand_player_statistics.cnt_f_call > 0 OR holdem_hand_player_statistics.flg_f_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_f_raise)),
(sum(holdem_hand_player_statistics.cnt_f_call)),
(sum((case when(holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_check AND (holdem_hand_player_statistics.cnt_t_raise > 0 OR holdem_hand_player_statistics.cnt_t_call > 0 OR holdem_hand_player_statistics.flg_t_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_t_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_t_call)),
(sum((case when(holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_check AND (holdem_hand_player_statistics.cnt_r_raise > 0 OR holdem_hand_player_statistics.cnt_r_call > 0 OR holdem_hand_player_statistics.flg_r_fold)) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_raise)),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_r_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.cnt_r_call)),
(sum((case when(holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won)),
(sum( (case when(holdem_hand_player_statistics.flg_won_hand) then holdem_hand_summary.amt_rake else 0 end) )),
(sum(holdem_hand_summary.amt_mgr)),
(sum(holdem_hand_player_detail.amt_blind)),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_4bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_4bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_cbet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_f_bet_facing > 0 AND holdem_hand_player_statistics.cnt_f_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.flg_f_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_face_raise AND holdem_hand_player_statistics.cnt_f_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0 AND holdem_hand_player_statistics.cnt_t_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_t_bet_facing > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.cnt_t_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise AND holdem_hand_player_statistics.flg_t_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0 AND holdem_hand_player_statistics.cnt_r_raise > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_detail.amt_r_bet_facing > 0) then 1 else 0 end))),
(sum(holdem_hand_player_statistics.amt_won * 1.0 / (holdem_limit.amt_bb *holdem_limit.val_nlpl_mult))),
(sum( (case when(holdem_hand_player_statistics.flg_p_first_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.cnt_r_call > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise AND holdem_hand_player_statistics.flg_r_fold) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_f_3bet_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_3bet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum( (case when( holdem_hand_player_statistics.flg_blind_def_opp AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp AND holdem_hand_player_statistics.enum_p_3bet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_float_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_r_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='C') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_t_donk_action='R') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_def_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_donk_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_r_float_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_t_float_opp) then 1 else 0 end))),
(count(distinct holdem_hand_player_statistics.id_session)),
(count( (SELECT (case when(sum(hhps_s.amt_won) > 0) then 1 else 0 end) FROM holdem_hand_player_statistics hhps_s WHERE (holdem_table_session_summary.id_session) = holdem_hand_player_statistics.id_session) )),
(sum((case when(holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.amt_rake > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_summary.cnt_players_f > 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_p_3bet_def_opp AND holdem_hand_player_statistics.enum_p_3bet_action='R' ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 1 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 2 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 3 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.cnt_p_raise > 0 AND holdem_hand_player_statistics.flg_f_3bet_def_opp ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_squeeze_opp ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_squeeze ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_f_cbet_action='F' ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_f_cbet_def_opp ) then 1 else 0 end))),
(holdem_table_session_summary.id_session),
(holdem_table_session_summary.id_session),
(sum((case when(holdem_hand_player_statistics.cnt_f_raise > 0 AND holdem_hand_player_statistics.flg_showdown) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.cnt_f_raise > 0 AND holdem_hand_player_statistics.flg_showdown AND holdem_hand_player_statistics.flg_won_hand) then 1 else 0 end))),
(sqrt(sum( (holdem_hand_player_statistics.amt_won * 1.0 / (holdem_limit.amt_bb *holdem_limit.val_nlpl_mult))^2 ))),
(sqrt(count(holdem_hand_player_statistics.id_hand))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 1) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 2) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 6) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 5) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_vpip AND holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.position = 4) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end))),
(holdem_hand_player_detail.amt_before),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b and holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_3bet) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_p_3bet_opp) then 1 else 0 end))),
(sum( (case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_vpip) then 1 else 0 end) )),
(sum( (case when(holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end) )),
(sum( (case when(holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.cnt_p_raise > 0) then 1 else 0 end) )),
(sum((case when( holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.cnt_p_raise > 0 ) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.id_hand > 0 AND holdem_hand_player_statistics.position = 3 ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_limp = false) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_ccall) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b AND holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_statistics.flg_p_fold = false AND holdem_hand_player_statistics.cnt_p_raise=0) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 0 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 1 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 2 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.position = 3 AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_s
AND holdem_hand_player_statistics.flg_blind_b = false AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_blind_b
AND holdem_hand_player_statistics.flg_blind_s = false AND holdem_hand_player_statistics.flg_p_face_raise) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.position = 9) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_opp AND holdem_hand_player_statistics.position = 9) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_opp AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false) then 1 else 0 end))),
(SUM((case when(holdem_hand_player_statistics.flg_steal_att AND holdem_hand_player_statistics.flg_blind_s AND holdem_hand_player_statistics.flg_blind_b = false) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.flg_f_cbet AND NOT(holdem_hand_player_statistics.flg_t_saw) AND NOT(holdem_hand_player_statistics.flg_f_face_raise)) then 1 else 0 end))
),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='C') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_f_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_t_cbet_action='C') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet_def_opp) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_detail.flg_f_open_opp AND NOT holdem_hand_player_statistics.flg_f_cbet_opp
AND (holdem_hand_player_detail.val_p_raise_aggressor_pos (sum((case when( holdem_hand_player_statistics.flg_p_face_raise AND holdem_hand_player_detail.flg_f_open AND NOT holdem_hand_player_statistics.flg_f_cbet_opp
AND (holdem_hand_player_detail.val_p_raise_aggressor_pos (sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='F') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_f_cbet_action='R') then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.enum_t_cbet_action='R') then 1 else 0 end))),
(sum( (case when(holdem_hand_summary.amt_rake>0.4) then (case when(holdem_hand_summary.amt_rake=3) then 2 else 1 end) else 0 end) )),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet) then 1 else 0 end))),
(sum((case when( holdem_hand_player_statistics.flg_p_3bet AND holdem_hand_player_statistics.flg_t_cbet_opp) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.enum_t_cbet_action='F' ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_t_cbet_def_opp ) then 1 else 0 end))),
(sum((case when(holdem_hand_player_statistics.enum_p_3bet_action='C' AND holdem_hand_player_statistics.flg_t_cbet_def_opp ) then 1 else 0 end))),
((case when( (sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_f_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_f_bet) then 1 else 0 end))) else 0 end)),
((case when( (sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_r_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_r_bet) then 1 else 0 end))) else 0 end)),
((case when( (sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))) > 0 ) then sum(holdem_hand_player_detail.val_t_bet_made_pct) * 1.0 / (sum((case when(holdem_hand_player_statistics.flg_t_bet) then 1 else 0 end))) else 0 end))
FROM
holdem_hand_player_statistics,
holdem_hand_summary,
holdem_hand_player_detail,
holdem_limit,
holdem_table_session_summary
WHERE (holdem_hand_summary.id_hand = holdem_hand_player_statistics.id_hand)
AND (holdem_hand_player_statistics.id_hand = holdem_hand_player_detail.id_hand AND holdem_hand_player_statistics.id_player = holdem_hand_player_detail.id_player)
AND (holdem_limit.id_limit = holdem_hand_player_statistics.id_limit)
AND (holdem_hand_player_statistics.id_session = holdem_table_session_summary.id_session)
AND (holdem_hand_summary.id_hand = holdem_hand_player_detail.id_hand)
AND (holdem_limit.id_limit = holdem_hand_summary.id_limit)
AND (holdem_limit.id_limit = holdem_table_session_summary.id_limit)
AND (holdem_hand_player_statistics.id_player = $1)
GROUP BY holdem_hand_player_statistics.id_player, holdem_hand_player_statistics.id_limit, holdem_hand_summary.cnt_players; Reason: Fatal Error (ERROR: column "holdem_table_session_summary.id_session" must appear in the GROUP BY clause or be used in an aggregate function )