Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello!
I need a little assistance with my case. I am trying to link 3 tables that contain several matching fields.
As it can be seen two of the tables(Table 1 and Table 2) have 4 common fields and Table 3 has only 2 fields matching with the others, I can link the first two by creating a composite key and inserting all relevant fields data into a link table.
My problem however is that I also need to connect the third table and as it doesn't contain month and year information and make it applicable(important price info) for the whole period of time available(it's the same in table 1 and table2). Could anyone provide any hints?
Use Master Calendar
Please share some sample data.
Table1:
Load
ProductID,
Category,
Year,
Month,
Balance,
from Table1;
left Join(Table1)
Load
ProductID,
Category,
Year,
Month,
Quantity
from Table2;
left Join(Table1)
Load
ProductID,
Category,
Price
from Table3;
hth
Sasi
Hi,
Table1:
Load
ProductID&' '&Category&' '&Year&' '&Month as Key,
ProductID&' '&Category as Key1,
ProductID,
Category,
Year,
Month,
Balance,
from Table1;
Table2:
Load
ProductID&' '&Category&' '&Year&' '&Month as Key,
//ProductID,
//Category,
//Year,
//Month,
Quantity
from Table2;
Table3:
Load
ProductID&' '&Category as Key1,
//ProductID,
//Category,
Price
from Table3;
try this
Table1:
load ProductID & Year & Month as Key1,
Balance
From Table1;
Table2:
load ProductID & Year & Month as Key2,
Quantity
From Table2;
LinkTable:
load distinct ProductID & Year & Month as Key1,
ProductID,
Year,
Month,
'Table1' as Flag
From Table1;
concatenate
load distinct ProductID & Year & Month as Key2,
ProductID,
Year,
Month,
'Table2' as Flag
From Table2;
Table3:
LOAD ProductID,
Category,
Price
From table3;