Database Implementations of ORDER BY in a Subquery
You're going to have to make your application not put the ORDER BY
inside the subquery (maybe it has an option to not use a needless subquery in the first place). As you've already discovered, this syntax is not supported in SQL Server without TOP
. And with TOP
, unless you want to leave some rows out, using TOP 100 PERCENT
is going to render the ORDER BY
optimized away anyway.
And in Oracle and PostGres, just because the syntax is supported, does not mean it is obeyed. And just because you observe it as being obeyed in some scenario, does not mean that it will continue to be obeyed as new versions come out or with subtle changes to your data, statistics, the query itself, or the environment.
I can assure you that, without a doubt, if you want a guarantee about order, you need to put the ORDER BY
on the outermost query. This should be a doctrine you hold close no matter what platform you're using.
You are asking for a link that officially states that something is not supported. This is like looking in your car owner's manual for an official statement that your car cannot fly.