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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Seier-Alsenz
Contributor II
Contributor II

where not exists - data matching does not work

Hi,

i have data sources (Table A and B). I just want to have records in table c that:
- Records from A that are not included in B
- Records from B that are not included in A

but i don't have the feeling that it works. for testing i set A=B (same data each 41 records). so i expect the result is null, 0 or error.  but the result is A concatonates B (all 82 records).

as a first solution attempt I used different qualifiers for the field ID from the different tables (like ID_tmp_V2). But this does not lead to success. as a second approach, I had provided ID with num() for safety, but that also did not lead to the result.

where is my thinking mistake?

(is there a simpler alternative to match the content of two data sources and get the inhat differences as a result?)



THE Code:


A:
LOAD
ID
FROM [lib://QVD Edited/$(vTodayBackUp2).qvd]
(qvd);

B:
LOAD
ID
FROM [lib://QVD Edited/$(vTodayBackUp2_old).qvd]
(qvd);


C:
LOAD
ID
RESIDENT A
WHERE NOT Exists(ID, 'B');

CONCATENATE (C)

C2:
LOAD
ID
RESIDENT B
WHERE NOT Exists(ID, 'A');

Labels (1)
1 Solution

Accepted Solutions
Sohan_Patil
Contributor III
Contributor III

Hi,

yes, we can rename the fields and it works 

Employees:
Load *, Employee As Emp;
LOAD * inline [
Employee|ID|Salary
Bill|001|20000
John|002|30000
Steve|003|35000
New|004|35774
] (delimiter is '|');


Citizens:
Load *, Employee As Emp1;
Load * inline [
Employee|Address
Bill|New York
Mary|London
Steve|Chicago
Lucy|Madrid
Lucy|Paris
John|Miami
] (delimiter is '|');

noConcatenate
E1:
load *
Resident Employees
where not Exists (Emp1, Emp);

Concatenate

C1:
load *
Resident Citizens
where not Exists(Emp, Employee);

drop Fields Emp,Emp1 from E1;
drop Tables Employees, Citizens;

Sohan_Patil_0-1694420603428.png

 

View solution in original post

2 Replies
Aurelien_Martinez
Partner - Specialist II
Partner - Specialist II

Hi,

You can try to rename field

 

A:
LOAD
ID,

ID as ID_A
FROM [lib://QVD Edited/$(vTodayBackUp2).qvd]
(qvd);

B:
LOAD
ID,

ID as ID_B
FROM [lib://QVD Edited/$(vTodayBackUp2_old).qvd]
(qvd);


C:
LOAD
ID
RESIDENT A
WHERE NOT Exists(ID_B, ID);

CONCATENATE (C)

C2:
LOAD
ID
RESIDENT B
WHERE NOT Exists(ID_A, ID);

Help users find answers! Don't forget to mark a solution that worked for you!
Sohan_Patil
Contributor III
Contributor III

Hi,

yes, we can rename the fields and it works 

Employees:
Load *, Employee As Emp;
LOAD * inline [
Employee|ID|Salary
Bill|001|20000
John|002|30000
Steve|003|35000
New|004|35774
] (delimiter is '|');


Citizens:
Load *, Employee As Emp1;
Load * inline [
Employee|Address
Bill|New York
Mary|London
Steve|Chicago
Lucy|Madrid
Lucy|Paris
John|Miami
] (delimiter is '|');

noConcatenate
E1:
load *
Resident Employees
where not Exists (Emp1, Emp);

Concatenate

C1:
load *
Resident Citizens
where not Exists(Emp, Employee);

drop Fields Emp,Emp1 from E1;
drop Tables Employees, Citizens;

Sohan_Patil_0-1694420603428.png