Subject RE: [ib-support] select statement with UNION
Author Thomas Steinmaurer
Rolf,

> thanks for your help. I'll use
>
> select LocationId, LocationName from Locations
> union
> select -5, Cast('(new location)' as VarChar(64)) from Locations
> order by 2;
>
> which works fine. The second part of the union returns only one row even
> when referencing table Locations.

Yes, because you are using UNION and not UNION ALL. It might
be faster when using the system table RDB$DATABASE, because
it contains only one record.


select LocationId, LocationName from Locations
union
select -5, Cast('(new location)' as VarChar(64)) from RDB$DATABASE
order by 2;


Regards,
Thomas Steinmaurer
http://www.iblogmanager.com