Hi I use sql server and I got this error when trying to execute a following query:
select
e.dept_id, count(e.dept_id) as empCount from employee e
group by e.dept_id
having empCount > 0;
Invalid column name 'empCount'.
When I write it like this:
having e.dept_id > 0;
It works but I want to replace it with alias empCount
.