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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to update merge and update 2 tables into a View

Status
Not open for further replies.

yeungsprite

Programmer
Nov 28, 2002
25
US
Hello!

I am trying to determine the syntax to merge 2 tables together with different schema into a View. The 2 tables are identical except one of them has an additional column. Whenever the View is called, it will retrieve all data from each table with no conditions or restrictions.

The site:
is a bit confusing to me...can I merge w/o conditions?

Any sample syntax / starting point / tips that can be provided would be much appreciated!

Thank you in advance!
 
hi yeungsprite

How about something like:
CREATE VIEW new_view AS
SELECT COLA, COLB, ' ' FROM TABLEA
UNION
SELECT COLA, COLB, COLC FROM TABLEB

SELECTs in a UNION need to have the same amount of columns so you'll need to dummy the extra column in one of the SELECTs.

Marc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top