Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Good day!
In load script i have such table:
Table:
load rowno(),
Id,
Name
from Source...
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 |
How to delete in load script dublicate rows, where Id and Name have the same value?
I need get such table:
rowno() | Id | Name |
1 | 1 | Name1 |
2 | 1 | Name2 |
3 | 2 | Name1 |
Thx.
load distinct rowno(),
Id,
Name
from Source...
The above load script is working as you expected
Yes using distinct we can get only unique numbers
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;
Add Distinct keyword before RowNo().
In the question, he mentioned, Where Id and Name have the same value?
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
];