Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewalex
Contributor III
Contributor III

QlikView SQL Select for SAP where Value is in other Table

Hello,

I load data from SAP in QlikView.

Table1:

SQL Select

  KNUMH,

     ...

from A004

where DATAB  <=  '$(vdateToDay)' and .............. ;

This part works well.

Now I'd like to add an other table. But only if the key "KNUMH" have the same value.

So I use a left join.

left join (Table1)

SQL select  MANDT,

     KNUMH,

     ...

from KONP;

This works but not very fast, because in KONP are 100 000 000 records and it load all records before the left join reduced the values. In Table1 I had the same problem, but after I add the "Where"-filter it works well.

Now I like to Select only the records where KNUMH is in Table1.

I try this way and some variants I find in the community:


SQL select  MANDT,

     KNUMH,

          ...

from KONP where  and KNUMH in (Select KNUMH FROM Table1);

But it doesn't work. I like to use Table1 for the selection, because Table1 is filtered.


Thank you for your support.


Regards

Alex


1 Solution

Accepted Solutions
qlikviewalex
Contributor III
Contributor III
Author

KONP:

sql subselect

KNUMH

KOPOS

KAPPL

KSCHL

KRECH

KBETR

KPEIN

KMEIN

from KONP

where KNUMH in (select KNUMH from A004 where DATAB <=  '$(vdateToDay)');

View solution in original post

1 Reply
qlikviewalex
Contributor III
Contributor III
Author

KONP:

sql subselect

KNUMH

KOPOS

KAPPL

KSCHL

KRECH

KBETR

KPEIN

KMEIN

from KONP

where KNUMH in (select KNUMH from A004 where DATAB <=  '$(vdateToDay)');