-1013: Too many order columns

Explanation:

The following causes of errors are possible:

...

       1.      More than 128 columns were specified as sort criteria or group columns (see Restrictions for SQL Statements).

       2.      The total length of the order or group columns exceeds 1020 bytes.

       3.      The length of the longest result data type of a DISTINCT function, together with the lengths of the group columns, exceeds 254 characters. The result data type is the data type which is assigned to the result of an expression.

User Action:

In the SQL statement, you must remove one or more columns specified in the ORDER clause or GROUP clause.