为什么这个语句会提示不是GROUP BY 表达式
select count(tb_user.dept_id),tb_dept.dept_desc FROM tb_user,tb_dept where tb_user.dept_id=tb_dept.dept_id GROUP BY tb_user.dept_id
------解决方案--------------------
你group by dept_id, 那么count()就应该用在dept_desc上,反之亦然,
所以要么是
select tb_user.dept_id, count(tb_dept.dept_desc) FROM tb_user,tb_dept where tb_user.dept_id=tb_dept.dept_id GROUP BY tb_user.dept_id;
要么是
select count(tb_user.dept_id), tb_dept.dept_desc FROM tb_user,tb_dept where tb_user.dept_id=tb_dept.dept_id GROUP BY tb_dept.dept_desc;