I am trying to do an Order by Case on a Select with a UNION ALL. I am getting the error: sql order by items must appear in the select list if the statement contains a union.
I have tried using the order by in both select statements, and have also tried parenthaszing both select statements and placing the order by at the end outside of the parenthesis, but to no avail.
Could someone please take a look at the attachment and let me know what I'm doing wrong? Thanks!