Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to overwrite the duplicate data in qlikview

Hi,

I have to overwrite existing data with the new one based on some specific field, how can we do that.

A:

Load * inline

[

Name,Age

A,21

B,22

]

B:

Load * inline

[

Name,Age

A,33

C,22

D,23

]

Final O/P

Name,Age

A,33

B,22

C,22

D,23

1 Solution

Accepted Solutions
maxgro
MVP
MVP

no change in order of load


A:

Load *, -rowno() as id inline

[

Name,Age

A,21

B,22

];

B:

Load *, rowno() as id inline [

Name,Age

A,33

C,22

D,23

];

left join (A)

load Name, max(id) as maxid

Resident A

group by Name;

Tmp: load Name, Age Resident A Where id = maxid;

DROP Table A;

RENAME Table Tmp to A;

View solution in original post

10 Replies
maxgro
MVP
MVP

maybe with a not exists starting from the last table

B:

Load * inline [

Name,Age

A,33

C,22

D,23

];

A:

Load * inline

[

Name,Age

A,21

B,22

]

Where not Exists(Name)

;

Not applicable
Author

Yes, this would work but, in our case we can't change the order of load, since we are creating some variables based on previous load. Please suggest some other solution.

jyothish8807
Master II
Master II

Hi navdeep,

Try like this:

A:

Load * inline

[

Name,Age

A,21

B,22

]

B:

Load * inline

[

Name,Age

A,33

C,22

D,23

]

Noconcatenate

c:

load

name,

max(Age) as Age

resident A

group by name;

Drop table A;

Regards

KC

Best Regards,
KC
Not applicable
Author

Thanks Joythish,

It's just a demo app, in prod we have lot of duplicates and we don't want this operation only for max value :-). but nice catch, and as mentioned we can't change the order of load.

maxgro
MVP
MVP

no change in order of load


A:

Load *, -rowno() as id inline

[

Name,Age

A,21

B,22

];

B:

Load *, rowno() as id inline [

Name,Age

A,33

C,22

D,23

];

left join (A)

load Name, max(id) as maxid

Resident A

group by Name;

Tmp: load Name, Age Resident A Where id = maxid;

DROP Table A;

RENAME Table Tmp to A;

flipside
Partner - Specialist II
Partner - Specialist II

This is how I would do it, but there are various ways ...

A:

Load *, 1 as LoadIndex inline
[
Name,Age
A,21
B,22
E,45
q,10
]
;

Load *, 2 as LoadIndex inline
[
Name,Age
A,33
C,22
D,23
E,13
Q,11
]
;

inner join (A)
Load Name, max(LoadIndex) as LoadIndex resident A group by Name;

flipside

NareshGuntur
Partner - Specialist
Partner - Specialist

Hi Navdeep,

Can you try this?

A:

Load * inline

[

Name,Age

A,21

B,22

];

B:

LOAD *,RowNo() as New;

Load * inline

[

Name,Age

A,33

C,22

D,23

];

Concatenate

LOAD * Resident A

Where not Exists(Name);

DROP Table A;

Cheers,

Naresh

Not applicable
Author

Hi,

I am not able to replicate, could you please share the app.

Not applicable
Author

We are not doing any operation on data of table B, could you please explain how it will work ?

Edited- Got it, thanks