Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
tamilarasu
Champion
Champion

Replace data in source table

Hi,

I have two tables and one is source data and another one is revised. I want to replace the source data with the revised data. Can any one suggest me a data model for this scenario.

Capture.PNG

Sample data attached.

Also, Is it possible to show the source records which are not available in revised table.

thank you

Regards,

Tamil

1 Solution

Accepted Solutions
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Data:

LOAD

*

FROM Table2;

Concatenate(Data)

LOAD

*

FROM Table1

WHERE Not Exists(Cust);

Hope this helps you.

Regards,

Jagan.

View solution in original post

4 Replies
jagan
Partner - Champion III
Partner - Champion III

Hi,

Try like this

Data:

LOAD

*

FROM Table2;

Concatenate(Data)

LOAD

*

FROM Table1

WHERE Not Exists(Cust);

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable

with only one sql query:

DATA:LOAD *;

SQL SELECT x.Cust as Cust,x.Prod as Prod,x.Type as Type,y.Price

from Table1 x,Table2 y

where x.cust=y.cust and x.Prod=y.Prod and x.Type=y.Type

union all

SELECT x.Cust as Cust,x.Prod as Prod,x.Type as Type,y.Price

from Table1 x where not exists(select * from Table2 y

where x.cust=y.cust and x.Prod=y.Prod and and x.Type=y.Type)

order by x.Cust,x.Prod,x.Type;

vinay_hg
Creator III
Creator III

Hi try Applymap from second table to first table, and use if condition, if matches then applymap result else use the same result from A table.

"if(table1.key=table2.key, applymap( from table 2 to table 1 to get price), table1.price)as price " in table 3 price column.

tamilarasu
Champion
Champion
Author

Thank you Jagan, Antonio and Vinaykumar.