MySQL: Why HAVING clause couldn't deal with column of window function?
I have such MySQL code: SELECT departmentId, name, salary, DENSE_RANK() OVER (PARTITION BY departmentId ORDER BY salary DESC) AS salary_rank FROM Employee HAVING departmentId = 1 This works properly as expected but if I change the HAVING clause as SELECT…