Page 1 of 1
Common hands

Posted:
Wed Aug 08, 2012 10:59 am
by pingvvino
How could I check (SQL query) common hands for player A and player B?
Re: Common hands

Posted:
Wed Aug 08, 2012 1:43 pm
by kraada
If you want the hand histories you'd do something like:
SELECT hhh.history from holdem_hand_histories hhh where hhh.id_hand in (SELECT hhps.id_hand from holdem_hand_player_statistics hhps, player p where p.id_player = hhps.id_player and p.player_name = 'Player A') and hhs.id_hand in (SELECT hhps.id_hand from holdem_hand_player_statistics hhps, player p where p.id_player = hhps.id_player and p.player_name = 'Player B')
replace Player A and Player B as needed. This kind of query will take some time to complete though especially as your database gets large, so keep that in mind.
Re: Common hands

Posted:
Wed Aug 08, 2012 3:17 pm
by pingvvino
Thanks, but I don't want to have detail hand history, count of those hands is enough. Is it any faster method?
Re: Common hands

Posted:
Wed Aug 08, 2012 5:34 pm
by kraada
This might be slightly faster:
SELECT count(distinct hhps.id_hand) from holdem_hand_player_statistics hhps, player p, holdem_hand_player_statistics hhps2, player p2 where hhps.id_player = p.id_player and hhps.id_hand = hhps2.id_hand and hhps2.id_player = p2.id_player and p.player_name = 'Player A' and p2.player_name = 'Player B'
But it's still going to take time no matter how you slice it.
Re: Common hands

Posted:
Fri Aug 10, 2012 4:48 pm
by Jenniferhoops
This is really an interesting and fast method.