Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
rishikeshtiwari
Creator
Creator

Want to update record from another table where null

Hi All,

I have two tables. In first table some fields are blank.In second table those fields are filled.

I want first table in which if any field is blanks then these values should fill in second table.

I am attachind data & result also.

Table 1:

ProductNumberProductNameFiscalYearOriginSales
1001A2000IND4000
1002B2001AUS5000
1003C20026000
1004D2003USA7000
1005E8000
1006F9000
1007G2006BRA10000
1008H2007CHI11000
1009I2008RUSS12000
1010J2009JAP13000

Table2:

ProductNumberProductNameFiscalYearOriginSales
1001A2000IND4000
1002B2001AUS5000
1003C2002FRA6000
1004D2003USA7000
1005E2004NUZ8000
1006F2005JER9000
1007G2006BRA10000
1008H11000
1009I12000

Result is

ProductNumberProductNameFiscalYearOriginSales
1001A2000IND4000
1002B2001AUS5000
1003C2002FRA6000
1004D2003USA7000
1005E2004NUZ8000
1006F2005JER9000
1007G2006BRA10000
1008H                                      2007CHI11000
1009I            2008RUSS

12000

3 Replies
giakoum
Partner - Master II
Partner - Master II

left join the columns you need from the second table onto the first

load * from Table1;

left join (Table1)

load

ProductNumber, //the field to join on - add more if needed

FiscalYear as FiscalYearTable2,

Origin as OriginTable2

from Table2

And then use if statements to fill the null values on the full table in a new load :

load

....,

if isnull(FiscalYear), FiscalYearTable2, FiscalYear) as FiscalYear

etc.

then drop the fields you do not need any longer

drop FiscalYearTable2

etc.

This is not working code, it is for illustration purposes only

PrashantSangle

Hi,

Use outer join

Try like

final_table

load * from table1;

outer join

load * from table2;

Regards

Great dreamer's dreams never fulfilled, they are always transcended.
Please appreciate our Qlik community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
its_anandrjs

Hi,

Try to join this tables

tmpTable1:

Load ProductNumber,    ProductName,    FiscalYear,    Origin,    Sales From Source;

Join

tmpTable2:

Load ProductNumber,    ProductName,    FiscalYear,    Origin,    Sales From Source;

NoConcatenate

FinalTab:

LOAD * Resident tmpTable1 Where Len(FiscalYear) > 0 and Len(Origin) > 0;

DROP Table tmpTable1;

Regards

Anand