Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

qlikviewalex
New 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
New Contributor III

Re: QlikView SQL Select for SAP where Value is in other Table

KONP:

sql subselect

KNUMH

KOPOS

KAPPL

KSCHL

KRECH

KBETR

KPEIN

KMEIN

from KONP

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

1 Reply
qlikviewalex
New Contributor III

Re: QlikView SQL Select for SAP where Value is in other Table

KONP:

sql subselect

KNUMH

KOPOS

KAPPL

KSCHL

KRECH

KBETR

KPEIN

KMEIN

from KONP

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

Community Browser