Hydra Error 374 Can only use column number in ORDER BY clause with UNION.

In this blog post, let’s learn about the error message “374 Can only use column number in ORDER BY clause with UNION.” in Hydra and the description of the error.

Error Message

374 Can only use column number in ORDER BY clause with UNION.

Error Details

This query has both a UNION clause and an ORDER BY clause. In a union query, in which multiple SELECT statements exist and the names of the selected columns in each statement are not necessarily the same, you cannot use column names or expressions in the ORDER BY clause.
Instead, you must use column position numbers, with 1 representing the first selected column, 2 representing the second, and so on. Rewrite the query to use only numbers in the ORDER BY clause.