select查詢的執行順序,select執行順序

來源:互聯網
上載者:User

select查詢的執行順序,select執行順序

一些不知道為什麼執行出錯的SQl語句,往往是因為你不瞭解他的執行順序。

Select distinct top n [percent] 列名

from 表名

where 條件

group by ... having ...

order by ... asc/desc


執行順序

1>...from 表

2>...where 條件

3>...group by    列

4>...having 篩選條件

5>...Select >選擇列 >distinct

6>...order by 列

7>...Top(最後計算)

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.