Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combining Tables

Status
Not open for further replies.

ejgb

Programmer
Oct 24, 2001
41
GB
I have two tables with the exact same structure, but contain different data, in two seperate schemas. I want to create a view so that too the users it looks like they are looking at one table.
 
create view myview as
select col1,col2 ... from table1
union
select col1, col2 ... from table2
 
If the data is truly different (that is, no rows with common values) or duplicate rows are acceptable, then
Code:
CREATE VIEW my_view AS
SELECT * FROM table1
UNION ALL
SELECT * FROM table2;
will be more efficient, since this avoids sorting the data before displaying it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top