Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
Table2:
LOAD `task_id` as ID ,
`label_id`,
where exists([task_id],ID);
SQL SELECT *
FROM database.table2;
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.
Hi Corinna.
if ID is not unique per record, QV only loads the 1st row it encounters. Could that be the case?
you can write
where task_id not in()
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.
Table2:
LOAD task_id as ID ,
label_id,
where exists(ID, task_id);
SQL SELECT *
FROM database.table2;
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