Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
KEY | |
0943906193201829.5 | |
094390619320183 | |
094390619320183.44 | |
094390619320188.72 | |
09439062022018159 | |
09439062022018159 | |
094390622201812.87 | |
0943906222018122.63 | |
0943906222018818.01 | |
094390622201899 | |
KEY | DupResult |
0943906193201829.5 | OK |
094390619320183 | OK |
094390619320183.44 | OK |
094390619320188.72 | OK |
09439062022018159 | OK |
09439062022018159 | DUP |
094390622201812.87 | OK |
0943906222018122.63 | OK |
0943906222018818.01 | OK |
094390622201899 | OK |
T:
load * inline [
KEY
0943906193201829.5
094390619320183
094390619320183.44
094390619320188.72
09439062022018159
09439062022018159
094390622201812.87
0943906222018122.63
0943906222018818.01
094390622201899
];
T2:
load
KEY,
if(KEY=Peek('KEY'), 'DUP', 'OK') as DupResult
Resident T
order by KEY;
drop table T;
To add clarity, I want the first instance to be OK but any duplicates to show as DUP.
T:
load * inline [
KEY
0943906193201829.5
094390619320183
094390619320183.44
094390619320188.72
09439062022018159
09439062022018159
094390622201812.87
0943906222018122.63
0943906222018818.01
094390622201899
];
T2:
load
KEY,
if(KEY=Peek('KEY'), 'DUP', 'OK') as DupResult
Resident T
order by KEY;
drop table T;
Thanks Massimo,
I have thousands of entries in KEY field
Do I need to list them all, as above?
Why don't you create a table with KEY as a dimension and add an expression counting the KEYs?
In case of being bigger than 1 this would mean that the field is duplicated.
you can add an if to the previous expression so you could have these keys labeled as OK and DUP.
you only need
T2:
load
KEY,
if(KEY=Peek('KEY'), 'DUP', 'OK') as DupResult
Resident YOURTABLE
order by KEY;
drop table YOURTABLE;
after the load of YOURTABLE
I added the inline load to check my script with your data; replace the inline load with the load of your data