MS SQL 2005 Plus 2 tables.

Mr_Bach
Mr_Bach used Ask the Experts™
on
I have 2 tables:

table1:
Customer  1   2   3   4   5   6   7   8   9   10.....  31
Cus1
Cus2
Cus3

table2:
Customer  1   2   3   4   5   6   7   8   9   10.....  31
Cus1
Cus2
Cus3

So I want to get table3 with select statement like this:

table3:
Customer  1   2   3   4   5   6   7   8   9   10.....  31
Cus1                                 (table1 + table2)
Cus2
Cus3

Please help me!
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Engineer
Commented:
Hi Mr_Bach!
Your question is not clear enough, anyhow and as I understood. You are looking for sql statement that returns the customers from two tables in a one result set.
You can use union so you can get one result. For example the Table1 has a customer name column "CustomerName" and also Table2 has a customer name column "CustName"
The union should be like attached code snippet.
Good Luck

Select CustomerName As [Customer_Name] From Table1
Union
Select CustName As [Customer_Name] From Table2

Open in new window

Author

Commented:
a

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial