-8013: Order column must be output column

Explanation:

...

       1.      For a QUERY statement with DISTINCT specification, only those column names that were specified as select columns can be specified in the ORDER clause.

       2.      If a column number is specified, you must ensure that this number is not greater than the number of specified output columns.

       3.      The number of output columns may have decreased in case of a SELECT * as a result of an ALTER TABLE statement with DROP definition.

User Action:

...

       1.      Do not use the DISTINCT specification or specify the column of the ORDER clause in a select column.

       2.      Correct the number in the ORDER clause accordingly.