All pastes #474316 Raw Edit

Anonymous

public sql v1 · immutable
·published 2007-05-06 19:21 UTC
rendered paste body
 end end end end end end end as final_hand_ab,/*not sure how to sum final_hands without using a redundant subquery so i was running the query once, totaling the raw count by hand, and then using that as TOTALNUMBER. ghetto, i know...*/--round(count(final_hand)::numeric/TOTALNUMBER*100,2) AS final_hand_countcount(final_hand) AS final_hand_countFROM(SELECT*,substring(hh.hand_history, 'RIVER.*?bets \\$([\\d.]*).*?SUMM')::numeric as the_flop_bet,substring(hh.hand_history, 'RIVER.*?raises to \\$([\\d.]*).*?SUMM')::numeric as the_flop_raiseFROM game gJOIN hand_histories hh ON g.game_number = hh.game_numberJOIN game_players gp ON g.game_id = gp.game_idJOIN players pl ON pl.player_id = gp.player_idAND hh.hand_history ~ ('FLOP.*?' || pl.screen_name || '[\\w\\s\\(\\)]*? raises.*?TURN')AND gp.went_to_showdown_n = 1)AS flop_raisesWHERE the_flop_raise < the_flop_bet * 2.1GROUP BY final_hand_ab ORDER BY final_hand_count DESC;