Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I'm trying to figure out how to write an update statement on Qlikview.
Table 1:
Code, Name, SalesArea, SalesValue
100, Amy, Area 1, 56040
101, Brian, Area 1, 78320
102, Carol, Area 2, 450
103, Diane, Area 3, 6590
201, StoreA, (blank), 4500
202, StoreB, (blank), 6010
203, StoreC, (blank), 8000
Table 2:
Code, Name, SalesArea
201, StoreA, Area 1
202, StoreB, Area 2
203, StoreC, Area 3
So what I'm trying to accomplish is, using Table 2 as a reference table, update the SalesArea in Table 1 for the customers that have codes starting with "2". However, I can't just use Table 2 because there is no SalesValue.
Any help would be appreciated!! Thank you!!
May be something like this:
Table:
LOAD * INLINE [
Code, Name, SalesArea, SalesValue
100, Amy, Area 1, 56040
101, Brian, Area 1, 78320
102, Carol, Area 2, 450
103, Diane, Area 3, 6590
201, StoreA, , 4500
202, StoreB, , 6010
203, StoreC, , 8000
];
Left Join (Table)
LOAD * Inline [
Code, Name, SalesArea1
201, StoreA, Area 1
202, StoreB, Area 2
203, StoreC, Area 3
];
FinalTable:
LOAD Code,
Name,
If(Len(Trim(SalesArea)) = 0, SalesArea1, SalesArea) as SalesArea,
SalesValue
Resident Table;
DROP Table Table;
May be something like this:
Table:
LOAD * INLINE [
Code, Name, SalesArea, SalesValue
100, Amy, Area 1, 56040
101, Brian, Area 1, 78320
102, Carol, Area 2, 450
103, Diane, Area 3, 6590
201, StoreA, , 4500
202, StoreB, , 6010
203, StoreC, , 8000
];
Left Join (Table)
LOAD * Inline [
Code, Name, SalesArea1
201, StoreA, Area 1
202, StoreB, Area 2
203, StoreC, Area 3
];
FinalTable:
LOAD Code,
Name,
If(Len(Trim(SalesArea)) = 0, SalesArea1, SalesArea) as SalesArea,
SalesValue
Resident Table;
DROP Table Table;
Thank you so much !!