Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join us at the Cloud Data and Analytics Tour! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Where Exists ID

Hi,

I already read several discussions concerning "where exists", but unfortunately it doesn't seem to work for me (though I think it should be quite simple).

I got two tables (SQL) which both have the column  id. I just want to load the rows of the second table which have an id which exists in table one.

Table1:

LOAD Id as ID,

    Title;

SQL SELECT *

FROM datbase.table1;

Table2:

LOAD `task_id` as ID ,

    `label_id`,

    where exists(ID);

SQL SELECT *

FROM database.table2;

I hope anyone can help me Thanks in advance

7 Replies
MK_QSL
MVP
MVP

Table2:

LOAD `task_id` as ID ,

    `label_id`,

    where exists([task_id],ID);

SQL SELECT *

FROM database.table2;

JonnyPoole
Employee
Employee

Do you want to add the rows from Table2 to the bottom of Table1 ?  if so then just add a 'concatenate' key word in lieu of the line 'Table2:'

if not and you want the tables separate its a bit more complicated and needs some joining , filtering and resident loads. But then it would associate to Table1 so i'm not sure you want that.

giakoum
Partner
Partner

Hi Corinna.

if ID is not unique per record, QV only loads the 1st row it encounters. Could that be the case?

Not applicable
Author

you can write

where task_id not in()

martynlloyd
Partner
Partner

Hi,

The most common use of exists is Where NOT Exists...

You would be better to use a Left Join for what you are doing.

Regards,

M.

maxgro
MVP
MVP

Table2:

LOAD task_id as ID ,

    label_id,

    where exists(ID, task_id);

SQL SELECT *

FROM database.table2;

michael_doetter
Contributor II
Contributor II

Hallo Corinna,

ich hatte mal ein ähnliches Problem. Habe es einfach über LEFT JOIN ID gelöst.

Tabelle 1 alle Daten / Tabelle 2 nur die Daten wo in Tabelle 1 die ID vorhanden ist.

Klappt prima. Vielleicht hilft es Dir.

LG

Micha