sum(if[char_length(cash_hand_summary.str_aggressors_p) >= 2 and char_length(cash_hand_summary.str_aggressors_t) = 1 and lookup_actions_f.action LIKE 'X%' and cash_hand_player_statistics.amt_t_bet_facing > 0 and lookup_actions_t.action = 'XC' and substring(cash_hand_summary.str_aggressors_t from 1 for 1)::int = substring(cash_hand_summary.str_aggressors_p from '.$')::int and char_length(cash_hand_summary.str_aggressors_r) >= 1 and cash_hand_player_statistics.amt_r_bet_facing > 0 and substring(cash_hand_summary.str_aggressors_r from 1 for 1)::int = substring(cash_hand_summary.str_aggressors_p from '.$')::int and lookup_actions_r.action SIMILAR TO '(F|XF)%', 1, 0])
sum(if[char_length(cash_hand_summary.str_aggressors_p) >= 2 and char_length(cash_hand_summary.str_aggressors_t) = 1 and lookup_actions_f.action LIKE 'X%' and cash_hand_player_statistics.amt_t_bet_facing > 0 and lookup_actions_t.action = 'XC' and substring(cash_hand_summary.str_aggressors_t from 1 for 1)::int = substring(cash_hand_summary.str_aggressors_p from '.$')::int and char_length(cash_hand_summary.str_aggressors_r) >= 1 and cash_hand_player_statistics.amt_r_bet_facing > 0 and substring(cash_hand_summary.str_aggressors_r from 1 for 1)::int = substring(cash_hand_summary.str_aggressors_p from '.$')::int, 1, 0])
it's wrong
How to correct it?