In this blog post, you’ll learn more about the Sybase Error Invalid ORDER BY specification and the reason for receiving this error
Sybase SQL Error Message
Invalid ORDER BY specification
Reason for this Error
Either you used an integer in an ORDER BY list and the integer is larger than the number of columns in the SELECT list, or you specified an ORDER BY expression that is semantically invalid. For example, for UNION, EXCEPT, and INTERSECT queries you can only use integers or column names of the first SELECT query block to specify an ordering of the result.