Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jduluc12
Creator
Creator

Load Distinct Resident not working

Hi,

This is my script.

[one]:
LOAD  * INLINE [
   list, amt, key
    1, 2, 1-2
    1, 4, 1-2
    2,3, 2-3
];
NoConcatenate
[two]:
load Distinct key, list, amt
Resident one;
drop Table one;

I was expecting the duplicate keys to drop in table two but they did not.

what am I missing here?

 

 

Labels (1)
1 Solution

Accepted Solutions
Frank_Hartmann
Master II
Master II

try this:

tmp:
LOAD  * INLINE [
   list, amt, key
    1, 2, 1-2
    1, 4, 1-2
    2,3, 2-3
];
NoConcatenate
DISTINCT:
LOAD distinct key,
     list,
     amt
    Resident tmp;

Final_DISTINCT:
NoConcatenate
LOAD *
Resident DISTINCT
Where key <> Previous(key)
Order By key;
DROP Tables DISTINCT,tmp;

View solution in original post

2 Replies
Frank_Hartmann
Master II
Master II

try this:

tmp:
LOAD  * INLINE [
   list, amt, key
    1, 2, 1-2
    1, 4, 1-2
    2,3, 2-3
];
NoConcatenate
DISTINCT:
LOAD distinct key,
     list,
     amt
    Resident tmp;

Final_DISTINCT:
NoConcatenate
LOAD *
Resident DISTINCT
Where key <> Previous(key)
Order By key;
DROP Tables DISTINCT,tmp;
Or
MVP
MVP

Distinct applies to an entire line, not to a single field. Since your lines are not duplicates due to a different amt value, they won't be removed by the DISTINCT.

Which of the two lines would you expect to be kept in this scenario? Or should the line be 1, 6, 1-2 because of sum(amt)?