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

Concatenate 2 different Tables into 1 View

Status
Not open for further replies.
Nov 4, 2002
19
GB
I am sure this is easy!

I need to take one table called "Company" and one table called "Individual" and merge them into one view. The ID for each entity in the respective table uses a unique ID from one system table, therefore this should be possible and without duplicates. (i.e. there is never a case where an individual and a company share the same ID)

e.g.
Individual Table
ID Name
1 Smith
3 Jones
5 Patel

Company Table
ID Name
2 Deloitte
4 PWC
6 KPMG

And the concatenated view should look like this:
View
ID Name
1 Smith
2 Deloitte
3 Jones
4 PWC
5 Patel
6 KPMG


Thanks for your help!
 
CREATE VIEW vBothTables AS
SELECT ID, Name FROM Individual
UNION ALL
SELECT ID, Name FROM Company


--Angel [rainbow]
-----------------------------------
Every time I lose my mind, I wonder
if it's really worth finding.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top