I have a Table that displays a teams salaries and I want to display their minimum, maximum and average salary for each team for each year.
My table looks like:
I run the following SQL:
SELECT MIN(salary), MAX(salary), AVG(salary), teamID, yearID FROM salaries;
But get the following error:
ERROR: column "salaries.teamid" must appear in the GROUP BY clause or be used in an aggregate function
What does it mean?
GROUP BY teamID, yearID
to the end of your query. - StuartLC