Can we compare values of two columns in a HAVING
clause?
Hi, welcome to the forums.
Do you have a specific example?
Remember, HAVING
filters groups (and is used with GROUP BY
) WHERE
filters rows. You can’t use WHERE
with aggregates, but you can use HAVING
with aggregates. You can use the WHERE
clause with HAVING
as well.
https://learnsql.com/blog/sql-having-clause-tutorial/
https://www.sqltutorial.org/sql-having/
one more:
https://www.tutorialgateway.org/sql-having-clause/
Example, like you can assume that a comparison has to be made on the column values of result of GROUP BY.