Re: Combining two tables into a view

From: Ken C. Stewart <ken_at_us.oracle.com>
Date: Tue, 20 Apr 1993 23:23:39 GMT
Message-ID: <ken.735348219_at_base>


pkane_at_diablo.cisco.com (Peter Kane) writes:

>I have two tables with the same fields, such as:
>table1: so_num char(10), prod char(10), price number
>table2: so_num char(10), prod char(10), price number
 

>and I would like to create a view so that these two tables
>look like one table. [stuff deleted]
 

>Any suggestions?

Try a union view:

CREATE VIEW total_tables
AS
(SELECT * FROM table1)
UNION
(SELECT * FROM table2);

Note that you may wish to experiment with the various options for making the rows in the view distinct (ie if a row occurs in both tables, should it appear once or twice in the view?) See the SQL Language Reference Guide for more details.

>Thanks,
 

>Peter
>pkane_at_cisco.com

--
Ken Stewart,                  Telephone:   (301) 907 2225
Technical Consultant,     	Fax:         (301) 657 0037
Oracle Federal,        		Oracle*Mail: kstewart.us
Bethesda, MD 20814              Internet:    kstewart_at_us.oracle.com
Received on Wed Apr 21 1993 - 01:23:39 CEST

Original text of this message