Two tables - 'salaries' and 'master1'
The salaries is by year, and I can group them to get the sums for each player using
SELECT playerID, sum(salary) as sal FROM salaries GROUP BY playerID ORDER BY sal DESC LIMIT 10;
This returns the playerID and sum of salary, but I need the names of the players from the 'master1' table under column 'nameFirst' and 'nameLast'. They have the common column of 'playerID' in both 'master1' and 'salaries' but when I try to run
SELECT master1.nameFirst, master1.nameLast, sum(salary) as sal FROM salaries, master1 GROUP BY salaries.playerID ORDER BY sal DESC LIMIT 10;
I get the error
Expression not in
GROUP BY key 'nameFirst'
I have tried tinkering with it to continue getting errors.