having与where最大的区别是having 能带聚合函数,而where不可以
select emp_id from t group by emp_id having count(*) = 1 --正确
select emp_id from t group by emp_id where count(*) = 1 --错误
如果用where要达到这个,估计这样
select t1.emp_id from (select emp_id,count(*) as cnt from t group by emp_id)t1 where t1.cnt=1