What\'s the execute order of the different parts of a SQL select statement? Such as distinct from order by group by having multiline function(count,
Have a look at
SQL SERVER – Logical Query Processing Phases – Order of Statement Execution
FROM ON OUTER WHERE GROUP BY CUBE | ROLLUP HAVING SELECT DISTINCT ORDER BY TOP
Also, for some good info see Logical Query Processing