Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
i'm trying to join 2 tables from sql syntax
first, i'm loading each sql syntax for each table, saving it as qvd file and then trying to do the join.
for some reason, its not working well.
the number of rows giving is not fit to the number of row giving when doing the same join on sql developer.
this is the syntax that i'm writing on qlik:
Bakasha:
SQL
select distinct
mispar_bakasha,
date_created
from bakashot;
Store Bakasha into [lib://files/Bakasha.qvd] (qvd);
Drop table Bakasha;
Mea:
SQL
select distinct
process_inner_id AS MISPAR_BAKASHA,
process_name;
Store MEA into [lib://files/MEA.qvd] (qvd);
Drop TABLE MEA;
LOAD *
FROM [lib://files/Bakasha.qvd];
INNER JOIN (Bakasha)
LOAD *
FROM [lib://files/MEA.qvd];
Any suggestion how to do it well?
Thanks alot!
Before going to the join, load the tables and check the data - especially on the key's. Are they loaded properly? Number of records and the content within the fields - before you store them and then after loading from the qvd's again.
Quite probably does anything not be like you would expect it - for example, in one table it are number and in the other it are strings or numbers/values are changed by removing leading zeros or spaces or similar stuff and so the key's didn't match anymore or previously different key's are now the same and causing duplicates. The simplest way to check for it respectively to avoid such trouble is to load the raw-data (here from the sql) per: text(Field) as Field.
whoho!
thanks alot! i found the problem! one of the "mispar bakasha" was a intger column and the other "mispar bakasha"
was a string column so the join didnt work properly.
i changed the srting to intger also and now its work perfectly!!
thanks everyone 🙂
you've aliased AS MISPAR_BAKASHA in upper case where in your first table its lower case mispar_bakasha so wont join.
Hello, thanks for the answer.
unfortunately this is not the problem.
i tried to change it to lower case and even then the join isn't working well.
when I'm association the tables without the join syntax i can see the link between them via "mispar bakasha" but the number of rows isnt making sense.
whem I'm using the join syntax for it, i can see it creating one table with the columns from both 2 tables but again, the number of rows isn't making sense.
i tired to wirte it on many ways but its giving me wrong number of rows all the time.
maby the join syntax isn't right?
Perhaps if you give some more information around what is "Wrong" i.e. current output using your various methods vs what you're expecting and we can help you better.
Sure, i will try to:
some general information:
"Bakasha" table has 7k rows with "mispar_bakasha" as primary key for this table.
"Mea" table has 23k rows with "process_inner_id" as primary key for this table.
we connect the table with mispar_bakasha = procees_inner_id (i changed the name of process inner id to mispar_bakasha so qlik sense will know to associate between those 2 table with this column.
when i do the left join via SQL Dev, i'm getting 7k rows with no nulls.
now for qlik sense:
On my first try, I tried to associate this 2 table without any explicit join and i saw on the "data load viewer" that there is a link between the "mispar_bakasha" from the first table to "mispar_bakasha" from the second table. But, when i'm doing the review or even trying to make any graph, i can see that there is no data from the second table (its all on null).
Here is some help around how joins work in Qlik Sense
For trouble shooting your issue create a simple table of the output fields if you are expecting 7k rows and are getting 15k rows what's causing the rows to duplicate? Can there be multiple process names against a mispar_bakasha for example.
Before going to the join, load the tables and check the data - especially on the key's. Are they loaded properly? Number of records and the content within the fields - before you store them and then after loading from the qvd's again.
Quite probably does anything not be like you would expect it - for example, in one table it are number and in the other it are strings or numbers/values are changed by removing leading zeros or spaces or similar stuff and so the key's didn't match anymore or previously different key's are now the same and causing duplicates. The simplest way to check for it respectively to avoid such trouble is to load the raw-data (here from the sql) per: text(Field) as Field.
whoho!
thanks alot! i found the problem! one of the "mispar bakasha" was a intger column and the other "mispar bakasha"
was a string column so the join didnt work properly.
i changed the srting to intger also and now its work perfectly!!
thanks everyone 🙂