dimanche 31 mai 2015

SQL: Must appear in the GROUP BY clause or be used in an aggregate function

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:

enter image description here

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

Aucun commentaire:

Enregistrer un commentaire