Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Delete dublicate rows in script

Good day!

In load script i have such table:

Table:

load rowno(),

Id,

Name

from Source...

 

rowno()IdName
11Name1
21Name1
31Name2
42Name1
52Name1
62Name1
72Name1
82Name1

How to delete in load script dublicate rows, where Id and Name have the same value?

I need get such table:

 

rowno()IdName
11Name1
21Name2
32Name1

Thx.

7 Replies
alexandros17
Partner - Champion III
Partner - Champion III

load distinct rowno(),

Id,

Name

from Source...

pavendhan
Partner - Contributor III
Partner - Contributor III

The above load script is working as you expected

vardhancse
Specialist III
Specialist III

Yes using distinct we can get only unique numbers

settu_periasamy
Master III
Master III

Hi,

Try this,

Tab1:

LOAD Distinct Id & Name as Key,Id,Name;

LOAD * INLINE [

    rowno, Id, Name

    1, 1, Name1

    2, 1, Name1

    3, 1, Name2

    4, 2, Name1

    5, 2, Name1

    6, 2, Name1

    7, 2, Name1

    8, 2, Name1

];

New:

Load RowNo(),Id,Name Resident Tab1;

DROP Table Tab1;

jsingh71
Partner - Specialist
Partner - Specialist

Add Distinct keyword before RowNo().

settu_periasamy
Master III
Master III

In the question, he mentioned, Where Id and Name have the same value?

Not applicable
Author

Try this.

DEL_DUP:

LOAD

RecNo() as ROW,

ID,

Name;

LOAD

Min(ROW) as ROW,

ID,

Name Group By ID,Name

;

LOAD * INLINE [

    ROW, ID, Name

    1, 1, Name1

    2, 1, Name1

    3, 1, Name2

    4, 2, Name1

    5, 2, Name1

    6, 2, Name1

    7, 2, Name1

    8, 2, Name1

];