I need a query that returns to each map the players that had battles in it, the amount of battles that each player had (in the respective map), the total time played (by player in the respective map), and the amount of transgressions (by player on the respective map). The tables are: classification, battles and trangressor_list and are structured as follows:
classification
Id | Player_Id | Battle_Id | Time_Played
battles
Id | Map_Id
trangressor_list
Id | Transgressor_Id | Battle_Id
The one I tried was the following:
SELECT Map_Id, Player_Id, COUNT(Player_Id) AS Quantidade, SUM(Time_Played) AS 'Time Played'
FROM classification, battles, trangressor_list
WHERE classification.Battle_Id = battles.Id AND trangressor_list.Battle_Id = battles.Id
GROUP BY Player_Id, Map_Id
ORDER BY Map_Id ASC, Player_Id ASC
;
This works partially, but it's not exactly what I need