Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hy guys. I would like to load all rows from a file even if there is no associations between table.
I`m having three tables.
Table1 with ID , Date , Value
Table2 with ID , Level1 , Level2,
Table3 with Level1 , Level2,Budget.
When I`m using the normal load it will only load all fields that have a match between tables.
Such as:
| ID | Date | Value |
|---|---|---|
| 1 | 06/01/2016 | 100 |
| 2 | 07/01/2016 | 50 |
| 3 | 08/01/2016 | 150 |
| ID | LEVEL1 | LEVEL2 |
|---|---|---|
| 1 | Electronics | Laptops |
| 2 | Electronics | SmartWatches |
| 3 | Electronics | SmartPhones |
| 4 | Electronics | Gaming |
| Level1 | Level2 | Budget |
|---|---|---|
| Electronics | Laptops | 700 |
| Electronics | SmartWatches | 300 |
| Electronics | SmartPhones | 400 |
| Electronics | Gaming | 200 |
What I want to do is to show all data in a pivot table even if there is no association between Table1 and Table 2. The result I would like to look something like this :
| ID | LEVEl1 | LEVEL2 | Value | Budget |
|---|---|---|---|---|
| 1 | Electronics | Laptops | 100 | 700 |
| 2 | Electronics | SmartWatches | 50 | 300 |
| 3 | Electronics | SmartPhones | 150 | 400 |
| 4 | Electronics | Gaming | 0 | 200 |
Please help me , because I can`t find a way to do this.
Would you able to provide sample and expected o/p
Hi Razvan,
Try this:
T1:
LOAD * Inline [
ID, Date, Value
1, 06/01/2016, 100
2, 07/01/2016, 50
3, 08/01/2016, 150];
T2:
LOAD * Inline [
ID, LEVEL1, LEVEL2
1, Electronics, Laptops
2, Electronics, SmartWatches
3, Electronics, SmartPhones
4, Electronics, Gaming
];
T3:
LOAD * Inline [
Level1, Level2, Budget
Electronics, Laptops, 700
Electronics, SmartWatches, 300
Electronics, SmartPhones, 400
Electronics, Gaming, 200];
NoConcatenate
Main_Table:
LOAD * Resident T1;
join
LOAD * Resident T2;
join
LOAD Level1 as LEVEL1, Level2 as LEVEL2,Budget
Resident T3;
Drop table T1,T2,T3;
Regards
KC
Hi ,
Please find the attached file
Pivot is showing Exact Result
I can`t provide the example. My value from level 2 is under level 1.
In my xls file I have data for it , but in my database where I have sums for every category it doesn`t exists.
What I can`t understand is that when I uncheck supress null values from level1 it shows me this info but not under the level where it should be.