Php 金额(计算每位球员的总欧元)

Php 金额(计算每位球员的总欧元),php,sql,Php,Sql,昨天,我开始用一些新的校友更新我的记分牌,在这里我得到了一些好的提示,所以我可以大胆地问另一个问题吗 这里有简单的SQL,但我需要欧元汇总的情况,以便显示在所有回合中获得或损失的欧元总额 选择t1.playerid、sumt1.points作为totalpoints、countt1.playerid作为rounds、avgpoints作为avgpoints 案例 当在7,6中计算t1.playerid时,从扑克Max_分数中选择点数作为t4,其中t1.playerid=t4.playerid和

昨天,我开始用一些新的校友更新我的记分牌,在这里我得到了一些好的提示,所以我可以大胆地问另一个问题吗

这里有简单的SQL,但我需要欧元汇总的情况,以便显示在所有回合中获得或损失的欧元总额

选择t1.playerid、sumt1.points作为totalpoints、countt1.playerid作为rounds、avgpoints作为avgpoints 案例 当在7,6中计算t1.playerid时,从扑克Max_分数中选择点数作为t4,其中t1.playerid=t4.playerid和t1.tournamentid=t4.tournamentid=38,然后是15 当在7,6,5中计算t1.playerid时,从pokermax_分数中选择点作为t4,其中t1.playerid=t4.playerid和t1.tournamentid=t4.tournamentid=25,然后是5 当在5,4中计算t1.playerid时,从pokermax_分数中选择点数作为t4,其中t1.playerid=t4.playerid和t1.tournamentid=t4.tournamentid=38,然后是10 当countt1.playerid=7,并从Poker Max_分数中选择点数作为t4,其中t1.playerid=t4.playerid和t1.tournamentid=t4.tournamentid=16,则为0 当countt1.playerid=4,并从Poker Max_分数中选择点数作为t4,其中t1.playerid=t4.playerid和t1.tournamentid=t4.tournamentid=25,则为0 其他-5 以欧元结束 从扑克牌来看,马克斯尤分数为t1 按t1.playerid分组
order by avgpoints desc解决方案如下:首先进行一个子查询,收集所有原始信息,然后在主查询中求和该总和

例如:

选择t3.playerid,sumt3.Euro 从…起 选择t2.玩家ID、t2.点数、t2.锦标赛ID、, 案例 当countt1.playerid in 7,6和t2.points=38时,则为15 当countt1.playerid在7,6,5和t2.points=25时,则为5 当countt1.playerid在5,4和t2.points=38时,则为10 当countt1.playerid=7和t2.points=16时,则为0 当countt1.playerid=4和t2.points=25时,则为0 其他-5 以欧元结束 从pokermax_得分为t1,pokermax_得分为t2 其中t1.tournamentid=t2.tournamentid 按t2分组。锦标赛ID,t2。玩家ID为t3
小组由t3.playeridc学习问题,以便更容易理解问题。