Example of how to use the Union operator

By: Borland Staff

Abstract: Example for Interbase 4.x and later

Problem:
A working example of how to use the union operator is not available.

Solution:
IB V4.x
IB V5.x

Here is an example of how to do this operation:

create database "a.gdb" user "sysdba" password "masterkey";
create table table1 (f1 char(5) not null, f2 char(5) not null);
create table table2 (f1 char(5) not null, f2 char(5) not null);
commit;
insert into table1 values ("1","a");
insert into table2 values ("2","b");
select * from table1 union select * from table2;

This select query will combine every record from both table1 and  table2
as the result set.  Select * can only be used with identical table structures
from both tables.  

Server Response from: ETNASC03