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: 
subbareddykm
Creator II
Creator II

Need help how to do ?

Hi All,

I Have one requirement like below.

Example: I ahve two tables Table _1 and Table_2.

Table_1:

Field1,

Field2,

Field3,

Field4

From................


Table_2:

Field1,

Field2

,Field3,

Field5,

Field6

From..................


Requirement is : I want to load only Where  Field2=Field2 and Field3=Field3 from Table_1


Can any one tell me how to do this ,any help would be appreciated,




Thanks in advance






.

14 Replies
sunny_talwar

May be try it where exists:

Table_1:

LOAD Field1,

          Field2,

          Field3,

          Field4

FROM....

Table2:

LOAD Field1,

          Field2,

          Field3,

          Field4,

          Field5,

          Field6

FROM....

Where Exists(Field2) and Exists(Field3);

Seems like this might not work, try maxgro‌'s solution below.

Best,

Sunny

subbareddykm
Creator II
Creator II
Author

But Will This same for my above logic  , means  in my requirement Field2=Field2 and Field3=Field3, right ?

Here we are taking entaire Field2 and Field3 from Table_1.

If we take left join Will it work ?

\

TKendrick20
Partner - Specialist
Partner - Specialist

Sounds like you just need a left join on both Field2 and Field3 so that only data that exists for those fields in both tables will be loaded.

maxgro
MVP
MVP

or maybe this

Table_1:

     Field2 & '-' & Field3 as F2F3,

     Field1,

     Field2,

     Field3,

     Field4

From................

      ;

Table_2:

     Field1,

     Field2

     Field3,

     Field5,

     Field6

From..................

Where Exists(F2F3, Field2 & '-' & Field3)

     ;

TKendrick20
Partner - Specialist
Partner - Specialist

I feel like I've encountered something like this before and I've needed a Qualify *; in there somewhere for this to work properly. Otherwise it might just be checking that data in Fields 2 & 3 exists.

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Maybe a bit dangerous, this code.

Two exists() calls on different fields won't check the actual combinations of required field values, just whether those values are present somewhere in each field.

If you need rows from Table_2 that have Field2 & Field3 combinations that exist in the same record in Table_1, you need to create a Key value, or perform a LEFT JOIN.

If you just need rows in Table_1 and Table_2 that have corresponding combinations, you can use an INNER JOIN (to merge tables), or an INNER KEEP (to keep two separate tables)

Best,

Peter

PS See Massimo's post below for an example using Key values.

subbareddykm
Creator II
Creator II
Author

If i use the above  same code i ll get sythatic keys also right?

sunny_talwar

Thanks for pointing that out Peter. I usually like testing my solutions before proposing them, but at times when a sample isn't available I try come up with a solution which I think might work. In this case I guess my solution won't work

sunny_talwar

Yes, unless you Drop Table_1.