Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the below table 1:
ID | col 1 | col 2 |
1 | 10 | a |
2 | 11 | b |
3 | 12 | c |
and some new data like this:
ID | col 1 | col 2 |
1 | 21 | b |
2 | 15 | b |
3 | 16 | c |
I need to update col 1 and col 2 in table 1 but only if the value of col 1 since its last load has changed more than 10. the result would look like this:
ID | col 1 | col 2 |
1 | 21 | b |
2 | 11 | b |
3 | 12 | c |
I've tried googling how to do this but i just dont know exactly what to google to find similar examples of this problem.
You can't update the values inside the table. First you need to join the tables and rename col1 and col2:
Left Join (table 1)
Load
ID,
col1 as col1new,
col2 as colnew2
resident table 2;
and then reload table 1 and create new field for col1 and col2 once again:
tablefinal:
load
ID,
IF(col1new-col1)>10,col1new,col1) as col1final,
IF(col1new-col1)>10,col2new,col2) as col2final
resident table1;
and drop tables 1 & 2 so you don't have unnecessary fields
Hi, Thanks for getting back to me 🙂 the new data is data in a sql DB, hasnt been loaded into qliksense. below is all i have at the moment, just a load script. I think I'm begging to understand the logic behind your method. Do I need to have the 2 tables in qliksense then join them or can this be done off the initial load?
Load ID,
Col1,
Col2;
[Table1]:
Select ID,
Col1,
Col2
FROM testdb..table1;
You can do this in initial load. You can even use join in SQL statement and load that statement if that works for you.
To be clear, in what I described you need to: load table1, join table2, load table1 once again (as new table) with the condition (delete table1 or fields depending if you loaded new table or added fields)