It's contributed rake and not weighted contributed like posted earlier in this thread.
- Code: Select all
SELECT hs.amt_rake / COUNT(pd2.amt_bet_p) AS contributed_rake FROM holdem_hand_player_detail pd
JOIN player p ON p.id_player = pd.id_player
JOIN holdem_hand_player_detail pd2 ON pd.id_hand = pd2.id_hand
JOIN player p2 ON p2.id_player = pd2.id_player
JOIN holdem_hand_summary hs ON pd2.id_hand = hs.id_hand
JOIN lookup_sites ls ON ls.id_site = hs.id_site
WHERE p.player_name like '%XXX%'
AND ls.site_name like '%XXX%'
AND pd.amt_bet_p >0
AND pd2.amt_bet_p >0
GROUP BY pd.id_hand, hs.amt_rake, ls.site_name;