The below query worked fine on another project (SQL), however now it seems to give no results and i do not get why. Have search allready for hours on the web for solutions. I have 2 tables, one GOALS (id_goals, season, player, goalsscored, assists, team) and another PLAYERS (id_player, name, and some more fields not important for this matter). id_player from PLAYERS is used in player field in GOALS. Now i want to display the name of the players and the total goals they have scored as well as the total assists they have made in a certain season for a certain team and this is the query I am using (but does not work anymore):
mysql_select_db($database_check_mag, $check_mag);
$query_getPosts = "SELECT id, tot_goals, player_name, tot_assists FROM
(SELECT g.player id, SUM(g.goalsscored) tot_goals, SUM(g.assists) tot_assists,
g.season, s.name player_name, s.id_player FROM goals g JOIN players s ON
g.player = s.id_player WHERE g.season = 20132 AND g.team = 39
GROUP BY g.player) sums GROUP BY id ORDER BY tot_goals DESC";
Can somebody help me and tell me what I do wrong?