SELECT BGRP.player_id as Player, COUNT(DISTINCT(BGRP.round_id)) AS Rounds, SUM(BGRP.win) as Wins, SUM(BGRP.loose) as Looses, SUM(BGRP.bye) as Bye, SUM(BGRP.sum) as Sum, IF(SUM(BGRP.sum)> 0 ,SUM(BGRP.sum),0) as TOTAL, SUM(BGRP.gp_added) as GPSum, (SUM(BGRP.sum)+(SUM(BGRP.gp_added)*GAMES.game_amount)) as SUMPLUSGP, (SELECT gp_added FROM bg_r_p_sum WHERE player_id = Player
AND round_id = '1410') AS GP FROM bg_r_p_sum as BGRP LEFT JOIN bg_games as GAMES on GAMES.game_id = BGRP.game_id WHERE BGRP.game_id='161' AND BGRP.round_id<'1410' GROUP BY BGRP.player_id ORDER BY SUMPLUSGP DESC, GPSum DESC, Player DESC, Rounds DESC