參考資料docs.microsoft.com：Logical Processing Order of the SELECT statement
- GROUP BY
- WITH CUBE or WITH ROLLUP
- ORDER BY
The preceding sequence is usually true. However, there are uncommon cases where the sequence may differ.
For example, suppose you have a clustered index on a view, and the view excludes some table rows, and the view’s SELECT column list uses a CONVERT that changes a data type from varchar to integer. In this situation, the CONVERT may execute before the WHERE clause executes. Uncommon indeed. Often there is a way to modify your view to avoid the different sequence, if it matters in your case.
還有一個很屌的網頁(SQL Fiddle)可以玩玩看，要先create table，執行完SQL可以顯示圖形化結果