使用上一个问题中的 Employee 和 Department 表
我正在尝试建立另一个组合表,显示在总部和研究部门工作的员工人数。
到目前为止,我已经尝试过了,但是在我的 having 子句中不断出现错误。有什么建议么?
mysql> select e.fname, d.dname
-> from department d
-> inner join employee e on e.dno = d.dnumber
-> group by e.fname
-> having d.dname='Headquarters','Research';
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to
use near ''Research'' at line 5
mysql> select e.fname, d.dname
-> from department d
-> inner join employee e on e.dno = d.dnumber
-> group by e.fname
-> having d.dname=1,5;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to
use near '5' at line 5