I want to make sure that the order of the result from the subquery is saved when using Union Different. Note that duplicate merging requires the use of "merge different".
For instance:
select columnA1, columnA2 from tableA order by [columnA3] asc
union distinct
select columnB1, columnB2 from tableB
When I run this, I expect that the records ordered from the subquery (select columnA1, columnA2from a tableAsort of [columnA3]asc), come first (as returned in order columnA3asc), and then out tableB.
I assume that I cannot add another dummy column because this would make the join great so as not to work. So this will not work:
select column1, column2 from
( select column1, column2, 1 as ORD from tableA order by [columnA3] asc
union distinct
select column1, column2, 2 as ORD from tableB
) order by ORD