Is order by clause allowed in a subquery

前端 未结 9 1538
离开以前
离开以前 2020-12-10 14:34

Is there any reason why or why not you should do an \'order by\' in a subquery?

9条回答
  •  南笙
    南笙 (楼主)
    2020-12-10 15:28

    No ORDER BY is valid in a subquery when you are interested in a subset of the overall data, hence you always need a TOP (SQL Server). There's no point having an ORDER BY without TOP in a subquery because the overall ordering of the results is handled by the outer query.

提交回复
热议问题