SQL - Do you have to repeat ORDER BY in outer query? -
i have query:
select t1.* t1 order t1.date
this query in enclosed in query:
select * (select t1.* t1 order t1.date) t2
do have repeat order by
in outer query? this:
select * (select t1.* t1 order t1.date) t2 order t2.date
does answer change if inner query moved cte?
yes ,you have repeat order in outer query,if want output ordered.
sqlserver honours order in outer query , inner order meaningless
Comments
Post a Comment