Got a query like the following:
use pubs
select state from publishers
union all
select state from authors
order by (case authors.state when 'UT' then 1 else 2 end),authors.state
Which should order states with 'UT' first. It works fine on just the authors table, but when the union is introduced I get an error:
The column prefix 'authors' does not match with a table name or alias name used in the query.
:-(
use pubs
select state from publishers
union all
select state from authors
order by (case authors.state when 'UT' then 1 else 2 end),authors.state
Which should order states with 'UT' first. It works fine on just the authors table, but when the union is introduced I get an error:
The column prefix 'authors' does not match with a table name or alias name used in the query.
:-(