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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Loading keys that not exist in table

Hello!

After loading two tables I want to append into second table rows with keys of first table that not exist in second table.

How can I do this using EXISTS Function?

Please see small example attached.

5 Replies
sunny_talwar

Try this Script:

t1:

LOAD id as idCheck,

  b;

LOAD * INLINE [

    id, b

    1, b1

    2, b2

    3, b3

    4, b4

    5, b5

];

t2: // Contains less rows than t1

LOAD * INLINE [

    id, c

    1, c1

    2, c2

    3, c3

];

// Trying to upload into t2 the absent keys from t1

Concatenate(t2)

LOAD

  idCheck as id,

  b as c

Resident t1

Where not Exists (id, idCheck);

DROP Table t1;

sunny_talwar

Output will look like this:

Output.PNG

Not applicable
Author

I understood the idea. But t1 and t2 have to be linked by 'id'.

sunny_talwar

Are you trying to merge them into one table or keep two tables?


1st Case:

T2 with T1 and T2 Data

or

2nd Case:

T1 with T1 Data and

T2 with T1 and T2 Data

which one are you trying to achieve?

Best,

Sunny

maxgro
MVP
MVP

t1:

LOAD id as idCheck,

  b;

LOAD * INLINE [

    id, b

    1, b1

    2, b2

    3, b3

    4, b4

    5, b5

];

t2: // Contains less rows than t1

LOAD * INLINE [

    id, c

    1, c1

    2, c2

    3, c3

];

// Trying to upload into t2 the absent keys from t1

Concatenate(t2)

LOAD

  idCheck as id,

  b as c

Resident t1

Where not Exists (id, idCheck);

t:

NoConcatenate

load idCheck as id, b

resident t1;

DROP Table t1;

RENAME Table t to t1;