HPE NonStop SQL/MX Error – 4166 ORDER BY clause is not supported in UNION of two streams. Tables in scope: name1, name2.

In this blog post, let’s learn about the error message “4166 ORDER BY clause is not supported in UNION of two streams. Tables in scope: name1, name2.” when working with HPE NonStop SQL/MX, the reason for the error and the solution to fix this error message.

Error Message

4166 ORDER BY clause is not supported in UNION of two streams. Tables in scope: name1, name2.

Reason for the Error

You attempted to use an ORDER BY clause in the UNION of two streams.

Solution

Modify the statement and resubmit