Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Left Join Duplicated rows

Assume I have a tableA:

   

No TypeDatePrice
pol01I1/1/201330000
pol02II1/5/201336000
pol03I4/15/201340000
pol04I5/7/201338000
pol05III6/14/201337000
pol06I7/5/201339900
pol07IV9/16/201342000
pol08IV11/2/201348000
pol09I11/18/201341000
pol10I12/13/2013

43000

And TableB:

   

Typepct1pct2pct3pct4
I0.40.20.20.2
II0.30.30.20.2
III0.30.30.30.1
IV0.40.30.20.1

I want to get all rows in TableA with all colums in TableB and pct1*Price as pmt1,pct2*Price as pmt2,pct3*Price as pmt3,pct4*Price as pmt4.

before starting the multiplication,

I used

Left Join (TableA)

Load *

Resident TableB

but keep getting duplicated records.

Anyone can help me with it?

1 Solution

Accepted Solutions
qlikviewwizard
Master II
Master II

Hi,

Use this code.

TableA:

LOAD * INLINE [No,Type,Date,Price

pol01,I,1/1/2013,30000

pol02,II,1/5/2013,36000

pol03,I,4/15/2013,40000

pol04,I,5/7/2013,38000

pol05,III,6/14/2013,37000

pol06,I,7/5/2013,39900

pol07,IV,9/16/2013,42000

pol08,IV,11/2/2013,48000

pol09,I,11/18/2013,41000

pol10,I,12/13/2013,43000

];

Left join (TableA)

TableB:

LOAD * INLINE [

Type,pct1,pct2,pct3,pct4

I,0.4,0.2,0.2,0.2

II,0.3,0.3,0.2,0.2

III,0.3,0.3,0.3,0.1

IV,0.4,0.3,0.2,0.1];

Table:

Load *,pct1*Price as pmt1,pct2*Price as pmt2,pct2*Price as pmt3

Resident TableA;

drop Table TableA;

View solution in original post

5 Replies
Not applicable
Author

when you use resident for read a table B i fink you have on your memory app this table. you read 2 times this table.

try below:

table_a:

NoTypeDatePrice
pol01I1/1/201330000
pol02II1/5/201336000
pol03I4/15/201340000
pol04I5/7/201338000
pol05III6/14/201337000
pol06I7/5/201339900
pol07IV9/16/201342000
pol08IV11/2/201348000
pol09I11/18/201341000
pol10I12/13/2013

43000


from source.

left join (table_a)

Typepct1pct2pct3pct4
I0.40.20.20.2
II0.30.30.20.2
III0.30.30.30.1
IV0.40.30.20.1

from source:

table:

load *,

pct1*Price as pmt1,

pct2*Price as pmt2,

pct3*Price as pmt3,

pct4*Price as pmt4


resident table_a; drop table table_a;


Not applicable
Author

I still get duplicated records.

sunny_talwar

What is your expected output from the data you have provided above?

Not applicable
Author

I will need a table with following fields:

No, Type, Date, Price, pct1, pct2,pct3,pct4,pmt1,pmt2,pmt3,pmt4

Later, I will need to use 'date' to slice data into smaller groups to calculate.

Thank you.

qlikviewwizard
Master II
Master II

Hi,

Use this code.

TableA:

LOAD * INLINE [No,Type,Date,Price

pol01,I,1/1/2013,30000

pol02,II,1/5/2013,36000

pol03,I,4/15/2013,40000

pol04,I,5/7/2013,38000

pol05,III,6/14/2013,37000

pol06,I,7/5/2013,39900

pol07,IV,9/16/2013,42000

pol08,IV,11/2/2013,48000

pol09,I,11/18/2013,41000

pol10,I,12/13/2013,43000

];

Left join (TableA)

TableB:

LOAD * INLINE [

Type,pct1,pct2,pct3,pct4

I,0.4,0.2,0.2,0.2

II,0.3,0.3,0.2,0.2

III,0.3,0.3,0.3,0.1

IV,0.4,0.3,0.2,0.1];

Table:

Load *,pct1*Price as pmt1,pct2*Price as pmt2,pct2*Price as pmt3

Resident TableA;

drop Table TableA;