the output of UNION/INTERSECT/EXCEPT.
SELECT name FROM distributors ORDER BY code;
-
+ A limitation of this feature is that an ORDER BY clause applying to the
+ result of a UNION, INTERSECT, or EXCEPT query may only specify an output
+ column name or number, not an expression.
+
+
Note that if an ORDER BY item is a simple name that matches both
a result column name and an input column name, ORDER BY will interpret
it as the result column name. This is the opposite of the choice that