This is probably simple but I’m just trying to learn SQL. I have two tables.
employee table;
Fname | Lname | Dno |
John | Smith | 5 |
Franklin | Wong | 5 |
Joyce | English | 5 |
Ramesh | Narayan | 5 |
James | Borg | 1 |
Jennifer | Wallace | 4 |
Ahmad | Jabbar | 4 |
Alicia | Zelaya | 4 |
department table;
dnumber | dname |
1 | Headquarters |
2 | Development |
3 | Sales |
4 | Administration |
5 | Research |
I’m try to use GROUP BY and table join to get the department name “dname” and the COUNT of the employees in each department that has a COUNT of more than 3 employees. If I use:
SELECT dname, COUNT(employee.dno)
FROM employee
INNER JOIN department ON department.dnumber = employee.dno
WHERE COUNT(employee.dno)>3
GROUP BY dname;
I get: Invalid use of group function
Thanks for help.
why767