I've got an error on my code saying "Invalid in the select list because it is not contained/ aggregate in the group by clause" like that. This error seems familiar to me in "MS SQL Server". I haven't encountered this error before in MySQL. This error came up when I upgraded my Php version to 7. All my previous web-based program before were affected
I tried to add more column in my "group by" clause, the error got away but the output is not what I am expected. The code below is my old code.
SELECT SUM(s.pscore) as towtal, s.pscore AS totalScore, s.cri_id,
c.can_id, c.canid,c.can_name FROM score s INNER JOIN candidate c ON
s.can_id = c.can_id WHERE cat_id=1 AND s.cri_id = '".$rows['cri_id']."'
AND c.can_sex = 'Female' AND c.can_id='".$kert[$i]."'
GROUP BY s.can_id ORDER BY s.can_id ASC LIMIT 5
When I add GROUP BY s.can_id, s.pscore
there will be no errors, but the output is not what I am expected