Hi there.
I'm trying to learn more about the basic implementation of SELECT statements in MSSQL. My understanding is that SQL will first evaluate the WHERE clause, followed by the ORDER BY and GROUP BY clauses (if any), then the HAVING clause (if any), and finally evaluate any aggregate or computed columns in the SELECT clause. I have noticed, however, that under certain circumstances the HAVING clause will be processed immediately after the WHERE clause and before the ORDER BY. Does anyone know where I can find more information on this? BOL and my current literature isn't quite detailed enough.
Many thanks.
I'm trying to learn more about the basic implementation of SELECT statements in MSSQL. My understanding is that SQL will first evaluate the WHERE clause, followed by the ORDER BY and GROUP BY clauses (if any), then the HAVING clause (if any), and finally evaluate any aggregate or computed columns in the SELECT clause. I have noticed, however, that under certain circumstances the HAVING clause will be processed immediately after the WHERE clause and before the ORDER BY. Does anyone know where I can find more information on this? BOL and my current literature isn't quite detailed enough.
Many thanks.