Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Merge of Tables

Author  Topic 

Yoda
Starting Member

1 Post

Posted - 2005-10-10 : 06:36:53
Can anyone help me here.

I have 2 table that I want to kind of merge together to create a 3 table.

Table one looks like:

Customer
A
B
C
etc

Table two looks like:

Type
1
2
3
4
5

I looking to create table three to look like:

Customer, Type
A 1
A 2
A 3
A 4
A 5
B 1
B 2
B 3
B 4
B 5
C 1
etc

Thanks

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-10 : 06:42:54
You dont need to create third table just use this Select Query

Select T1.Customer, T2.type from Table1 T1 Cross join Table2 T2 order by T1.Customer

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2005-10-10 : 06:51:42
And also if you want to create the 3rd table then you use the following query for it.

Select T1.Customer, T2.type Into third_tableName
from Table1 T1 Cross join Table2 T2 order by T1.Customer





Complicated things can be done by simple thinking
Go to Top of Page
   

- Advertisement -