我需要建立一个梦幻足球游戏用户排行榜。游戏的简化数据库如下:
users必须squad_players在squads每一个matches(由相关transfer_period)players有match_points每个matchessquad_players有位置,优先。该优先级是如果换人的顺序squad_players不会出现在matches squads具有formations确定从优先级排序的每个位置中选择的最大玩家数量数据库为MySQL 5.6,最大数量users为10K。
我能够内部加入(按顺序)squad_players, squads, matches,match_points以获得每个squad_players玩过的人(players没有玩过的人没有match_points)的观点。
我奋力SUM的分X squad_players每squads其中X是formations通过确定位置的的squad_players。
我试图通过具有相关子查询的group by修改 …
mysql database-design group-by mysql-5.6 greatest-n-per-group