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(最后计算)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章