Subject Re: [firebird-support] ODER BY após UNION o u UNION ALL
Author Almond
>
>Paulo,
>
>You should write in English on this list.
>
>Create a view with your select and union and then select from that view
>with an order by clause.
>
>create view vTest(ColumnA, ColumnB) as
>select
> ColumnA, Column B
>from
> TableA
>union all
>select
> ColumnA, Column B
>from
> TableB;
>
>select * from vTest order by ColumnA

An union can be ordered by field number. The above can be rewrote to:

create view vTest(ColumnA, ColumnB) as
select
ColumnA, Column B
from
TableA
union all
select
ColumnA, Column B
from
TableB
Order by 1, 2 or (or Order by 2, 1, etc)
^^^^^^^^^^^^^^

Hope this help.

Best regards,

Almond Wong