Hi All,
I am again struck in between of a very confusing problem!!!
This time my problem is as below:
I have got 3 tables which are explained as below:
Table 1: It has got 40 columns which goes as :
Col 1: Customer name
Col 2: Customer address
.
.
.
.
.
.Col 40: Customer id (which can/can not be repeating)
Table 2: It has got 40 columns:
Col 1: Customer id (same as Table 1 but they can be less/more than Table1)
Col 2: Customer phone numbers
.
..
.
.
.
.
.
.Col 40: Customer city code (which again can/can not be repeating)
Table 3: It has got 40 columns:
Col 1: Customer city code (same as Table 2 but they can be less/more than Table2)
Col 2: Other information
.
.
.
.
.
.
.
.Col 40: some information
What I need is to generate a new table which is combination of these 3 tables? The new table should consist 120 columns in all and should be like:
all the information (40 columns of table 1), then comapre the customer id present in both table 1 and 2 and provide all the details of table 2 i.e. all 39 columns for all the customer ids common to both tables and then compare city code of table 2 and 3 and list all the information of table 3 for all the common city codes present in both table 2 and 3.
I'll state a simple example for more clarification:
Table 1:
Col 1 row 1 jon
Col 1 row 2 nina
Col 2 row 1 dallas
Col 2 row 2 NY
.
.
.
.
.
.
Col 40 row 1 A0001
Col 40 row 2 A0002
Table 2
Col 1 row 1 A0001
Col 1 row 2 A0002
Col 1 row 3 A0003
Col 2 row 1 XYZ
COl 2 row 2 XYZ12
Col 2 row 3 GSHD
.
.
.
.
.
.
.
.
Col 40 row 1 B0001
Col 40 row 2 B0002
Col 40 row 3 B0003
Col 40 row 4 B0004
Table 3:
Col 1 row 1 B0001
Col 1 row 2 B0002
Col 1 row 3 B0003
Col 1 row 4 B0004
COl 2 row 1 24$
Col 2 row 2 30$
Col 2 row 3 30$
Col 2 row 4 0$
.
.
.
.
upto col 40.
The table according to my problem should look like:
Col 1 row 1 jon
Col 1 row 2 nina
Col 2 row 1 dallas
Col 2 row 2 NY
.
.
.
.
.
.
Col 40 row 1 A0001
Col 40 row 2 A0002
Col 41 row 1 XYZ
COl 42 row 2 XYZ12 (As A0001 and A0002 are common we take only these 2 rows and leave the 3rd one from the table)
.
.
.
.
.
Col 89 row 1 B0001
Col 89 row 2 B0002
Col 89 row 3 B0003
Col 89 row 4 B0004 (As again B0001,B0002,B0003 and B0004 are common we take these 4 and their repective information)
.
COl 90 row 1 24$
Col 90 row 2 30$
Col 90 row 3 30$
Col 90 row 4 0$
.
.
.
.
upto col 118.
I hope I have made myself clear!!! Please help me to sort this problem. Thanks in advance.
Please revert in case of any more questions.
I am again struck in between of a very confusing problem!!!
This time my problem is as below:
I have got 3 tables which are explained as below:
Table 1: It has got 40 columns which goes as :
Col 1: Customer name
Col 2: Customer address
.
.
.
.
.
.Col 40: Customer id (which can/can not be repeating)
Table 2: It has got 40 columns:
Col 1: Customer id (same as Table 1 but they can be less/more than Table1)
Col 2: Customer phone numbers
.
..
.
.
.
.
.
.Col 40: Customer city code (which again can/can not be repeating)
Table 3: It has got 40 columns:
Col 1: Customer city code (same as Table 2 but they can be less/more than Table2)
Col 2: Other information
.
.
.
.
.
.
.
.Col 40: some information
What I need is to generate a new table which is combination of these 3 tables? The new table should consist 120 columns in all and should be like:
all the information (40 columns of table 1), then comapre the customer id present in both table 1 and 2 and provide all the details of table 2 i.e. all 39 columns for all the customer ids common to both tables and then compare city code of table 2 and 3 and list all the information of table 3 for all the common city codes present in both table 2 and 3.
I'll state a simple example for more clarification:
Table 1:
Col 1 row 1 jon
Col 1 row 2 nina
Col 2 row 1 dallas
Col 2 row 2 NY
.
.
.
.
.
.
Col 40 row 1 A0001
Col 40 row 2 A0002
Table 2
Col 1 row 1 A0001
Col 1 row 2 A0002
Col 1 row 3 A0003
Col 2 row 1 XYZ
COl 2 row 2 XYZ12
Col 2 row 3 GSHD
.
.
.
.
.
.
.
.
Col 40 row 1 B0001
Col 40 row 2 B0002
Col 40 row 3 B0003
Col 40 row 4 B0004
Table 3:
Col 1 row 1 B0001
Col 1 row 2 B0002
Col 1 row 3 B0003
Col 1 row 4 B0004
COl 2 row 1 24$
Col 2 row 2 30$
Col 2 row 3 30$
Col 2 row 4 0$
.
.
.
.
upto col 40.
The table according to my problem should look like:
Col 1 row 1 jon
Col 1 row 2 nina
Col 2 row 1 dallas
Col 2 row 2 NY
.
.
.
.
.
.
Col 40 row 1 A0001
Col 40 row 2 A0002
Col 41 row 1 XYZ
COl 42 row 2 XYZ12 (As A0001 and A0002 are common we take only these 2 rows and leave the 3rd one from the table)
.
.
.
.
.
Col 89 row 1 B0001
Col 89 row 2 B0002
Col 89 row 3 B0003
Col 89 row 4 B0004 (As again B0001,B0002,B0003 and B0004 are common we take these 4 and their repective information)
.
COl 90 row 1 24$
Col 90 row 2 30$
Col 90 row 3 30$
Col 90 row 4 0$
.
.
.
.
upto col 118.
I hope I have made myself clear!!! Please help me to sort this problem. Thanks in advance.
Please revert in case of any more questions.