Oh, in that case, you need deptno in the select fields to be able to use it in the HAVING clause:

I'm betting that's not what you want though. The GROUP BY will compress rows for multiple deptnos together, so you'll sort of arbitrarily filter out data. You want to filter out all the rows that aren't deptno 3 before you group together data. Something like: