Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I need to join (or keep I honestly don't know) two tables.
TABLE_1
CODE_STORE | CODE_DEP | DATE | SALES |
---|---|---|---|
A | 1 | 02/01/2018 | 100 |
A | 1 | 03/01/2018 | 50 |
A | 2 | 01/01/2018 | 75 |
A | 2 | 02/01/2018 | 25 |
A | 3 | 01/01/2018 | 100 |
A | 4 | 01/01/2018 | 100 |
TABLE_2
CODE_STORE | CODE_DEP | CODE_DEP2 | WEIGHT_% | CODE_DEP_MIN | DESC_DEP_MIN | DEP_MIN |
---|---|---|---|---|---|---|
A | 1 | 1a | 30% | 01 | RED | 01 - RED |
A | 1 | 1b | 70% | 02 | BLUE | 02 - BLUE |
A | 1 | 1a | 30% | 01 | RED | 01 - RED |
A | 1 | 1b | 70% | 02 | BLUE | 02 - BLUE |
A | 2 | 2a | 50% | 03 | YELLOW | 03 - YELLOW |
A | 2 | 2b | 50% | 04 | GREEN | 04 - GREEN |
A | 2 | 2a | 50% | 03 | YELLOW | 03 - YELLOW |
A | 2 | 2b | 50% | 04 | GREEN | 04 - GREEN |
A | 3 | 3a | 40% | 05 | ORANGE | 05 - ORANGE |
A | 3 | 3b | 60% | 06 | BROWN | 06 - BROWN |
A | 4 | 4a | 20% | 07 | BLACK | 07 - BLACK |
A | 4 | 4b | 80% | 08 | WHITE | 08 - WHITE |
What I need to get is something like this
CODE_STORE | CODE_DEP | DATE | SALES | CODE_DEP2 | WEIGHT_% | CODE_DEP_MIN | DESC_DEP_MIN | DEP_MIN |
---|---|---|---|---|---|---|---|---|
A | 1 | 02/01/2018 | 100 | 1a | 30% | 01 | RED | 01 - RED |
A | 1 | 02/01/2018 | 100 | 1b | 70% | 02 | BLUE | 02 - BLUE |
A | 1 | 03/01/2018 | 50 | 1a | 30% | 01 | RED | 01 - RED |
A | 1 | 03/01/2018 | 50 | 1b | 70% | 02 | BLUE | 02 - BLUE |
A | 2 | 01/01/2018 | 75 | 2a | 50% | 03 | YELLOW | 03 - YELLOW |
A | 2 | 01/01/2018 | 75 | 2b | 50% | 04 | GREEN | 04 - GREEN |
A | 2 | 02/01/2018 | 25 | 2a | 50% | 03 | YELLOW | 03 - YELLOW |
A | 2 | 02/01/2018 | 25 | 2b | 50% | 04 | GREEN | 04 - GREEN |
A | 3 | 01/01/2018 | 100 | 3a | 40% | 05 | ORANGE | 05 - ORANGE |
A | 3 | 01/01/2018 | 100 | 3b | 60% | 06 | BROWN | 06 - BROWN |
A | 4 | 01/01/2018 | 100 | 4a | 20% | 07 | BLACK | 07 - BLACK |
A | 4 | 01/01/2018 | 100 | 4b | 80% | 08 | WHITE | 08 - WHITE |
Any suggestions on how can I get this?
Thank you
I've managed to join the two tables by myself.
Here's my solution to the problem
TABLE_3:
NoConcatenate
Load *
Resident TABLE_2;
left join (TABLE_3)
Load *
Resident TABLE_1;
Drop Table TABLE_1;
Drop Table TABLE_2;
If anybody else has a better solution let me know.
Thanks again.
I've managed to join the two tables by myself.
Here's my solution to the problem
TABLE_3:
NoConcatenate
Load *
Resident TABLE_2;
left join (TABLE_3)
Load *
Resident TABLE_1;
Drop Table TABLE_1;
Drop Table TABLE_2;
If anybody else has a better solution let me know.
Thanks again.