Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Finding a match, one to many join

Hello

I've got two files that I'm loading into QV. File A has a unique key (no duplicates), the other, File B, has duplicate records for each key. File A may have a match to one or many records on File B, or there may be no match. I want to add a field to File A to say whether there is a matching record/s in File B. I'm not interested in how many records are on B for a particular key, just whether there are any matching records or not.

Can anyone help?

Thanks!

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Hi,

Try this solution:

MapFile:

Mapping Load Key, 'Matched' as Flag

Resident B;

AA:

Load Key, ApplyMap('MapFile',Key) as MatchFlag

Resident A;

Hope this would help you(your new field in A is matchflag).

Regards, tresesco

View solution in original post

2 Replies
tresesco
MVP
MVP

Hi,

Try this solution:

MapFile:

Mapping Load Key, 'Matched' as Flag

Resident B;

AA:

Load Key, ApplyMap('MapFile',Key) as MatchFlag

Resident A;

Hope this would help you(your new field in A is matchflag).

Regards, tresesco

sparur
Specialist II
Specialist II

Hello, James.

If I understand you, you can to use RIGHT KEEP statement for loading data, like as:

Table_A:

LOAD KeyField, .... FROM....

Table_B:

RIGHT KEEP(Table_A)

LOAD KeyField, .... FROM....

after loading this script you will get two tables:

Table_B - all lines table B (as in source data)

Table_A - only lines, which are exists in Table_B (by KeyField)