- Code: Select all
SELECT summary.date_played,
sites.site_abbrev AS site,
hhh.id_hand,
hero_d.holecard_1 AS hero_hc1,
hero_d.holecard_2 AS hero_hc2,
hero_d.amt_before AS hero_amt_before,
hero_d.amt_bet_ttl AS hero_amt_bet_ttl,
villain_d.holecard_1 AS villain_hc1,
villain_d.holecard_2 AS villain_hc2,
villain_d.amt_before AS villain_amt_before,
villain_d.amt_bet_ttl AS villain_amt_bet_ttl,
(CASE
WHEN hero_s.enum_allin = 'N' THEN villain_s.enum_allin
ELSE hero_s.enum_allin
END) AS allin_street,
history,
card_1 AS flop1,
card_2 AS flop2,
card_3 AS flop3,
card_4 AS turn,
card_5 AS river,
amt_pot AS potsize,
hero_s.flg_won_hand AS hero_won,
villain_s.flg_won_hand AS villain_won
FROM player p,
tourney_holdem_hand_player_detail hero_d,
tourney_holdem_hand_player_detail villain_d,
tourney_holdem_hand_player_statistics hero_s,
tourney_holdem_hand_player_statistics villain_s,
tourney_holdem_hand_summary summary,
lookup_sites sites,
tourney_holdem_hand_histories hhh
WHERE p.player_name = 'advis0r'
AND hero_d.id_player = p.id_player
AND hero_s.id_player = p.id_player
AND villain_d.id_player != p.id_player
AND villain_s.id_player != p.id_player
AND summary.id_site != 0
AND hhh.id_hand = hero_d.id_hand
AND hhh.id_hand = hero_s.id_hand
AND hhh.id_hand = villain_d.id_hand
AND hhh.id_hand = villain_s.id_hand
AND hhh.id_hand = summary.id_hand
AND summary.id_site = sites.id_site
AND hero_s.flg_showdown = true
AND villain_s.flg_showdown = true
AND ((hero_d.amt_bet_p + hero_d.amt_bet_f + hero_d.amt_bet_t = villain_d.amt_before)
OR (villain_d.amt_bet_p + villain_d.amt_bet_f + villain_d.amt_bet_t = hero_d.amt_before))
AND ((SELECT COUNT(* )
FROM tourney_holdem_hand_player_statistics foo
WHERE foo.id_hand = hhh.id_hand
AND foo.flg_showdown = true) = 2)
ORDER BY summary.date_played