Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have two tables one with unique key and another table this key has multiple records now i have to join the unique records based on the primary key please help me to resolve this issue.
Thanks in Advance
First Load table which has multiple records for single key.
Left Join this table with the Unique Key Table.
eg.
Load
*,
ProductId
From SecondTable;
Left Join
Load
ProductId,
Group
From FirstTable;
Table1:
load
field1,
field2
from.....
table2:
load field1
resident table1;
left join(Table2)
field1,
field3
from......
hope this helps u
Hi,
If I consider the two tables you have: table1 (with Primary Key) and table2 (child records), you may go for:
FinalTable:
noconcatenate
load * resident table1;
left join
load * Resident table2;
But the above gives you all the records irrespective wether child exists or not for Primary keys in table1. While code below
FinalTable:
noconcatenate
load * resident table1;
join
load * Resident table2;
gives only the matching records in both tables
Do you need to join the two tables?
Just load the two tables separately and let QlikView associate the data on the unique key.
You just need to make sure the unique key has the same name on both tables.
No I have to join both the tables. both has different fields and the relation is primary key.
for example
table1
key f1 f2 f3
1 a b c
2 a b c
table 2
f4 f5 f6 f7
1 x y z
1 y z x
2 x k m
2 e s g
based on key and f4 i have to join.......
--------------------
Thanks for your reply sir
You just need to rename column f4 as key in table2, then the tables will be associated in QlikView. You do not need to use join.
Hi ,
LOAD * INLINE [
key,f1,f2,f3
1, a, b, c
2, a, b, c
];
JOIN
load F1 AS key,F2,F3,F4
INLINE [
F1, F2, F3, F4
1, x, y, z
1, y, z, x
2, x, k, m
2, e, s, g
];
Thanks,
Anjee
You do not need to join the tables, just rename the fields and load the data into separate tables.
The associative logic in QlikView will create the links between the tables automatically based on the field names. No joins!
table1:
LOAD
key,
f1,
f2,
f3
from .... ;
table2
load f4 AS key,
f5,
f6,
f7
from .... ;
Hi Albert,
hmm ya you are right ...
i am aware that that there is of no need to join as associative logic will build a relation between those two tables.
Since he has asked to join the tables,so i have added join keyword between those tables.
Thanks,
Anjee