Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Isolate Duplicate Key Field

I need to create a resident table in my data model that contains all the rows in Temp2 that contain a duplicated LoadNumber.  In this example, 1237, 100 ; 1237, 150.0 ; 1241, 75 ; 1241, 100.0 ;  1241, 125 ;  1241, 250.  I have tried a variety of joins and experimented with EXISTS, but I'm not obtaining the table I need.  Any suggestions will be greatly appreciated!

Temp2:

LOAD * INLINE [

    LoadNumber, ManifestClass

    1234, 50

    1235, 100

    1236, 75.0

    1237, 100

    1237, 150.0

    1240, 250

    1241, 75

    1241, 100.0

    1241, 125

    1241, 250

];

Thanks,

Steve

1 Solution

Accepted Solutions
maxgro
MVP
MVP

Temp2:

LOAD * INLINE [

    LoadNumber, ManifestClass

    1234, 50

    1235, 100

    1236, 75.0

    1237, 100

    1237, 150.0

    1240, 250

    1241, 75

    1241, 100.0

    1241, 125

    1241, 250

];

left join (Temp2)

load LoadNumber,

if(count(LoadNumber)>1, 'DUPLICATE', 'OK') as flag

Resident

Temp2

group by LoadNumber;

1.png

View solution in original post

2 Replies
maxgro
MVP
MVP

Temp2:

LOAD * INLINE [

    LoadNumber, ManifestClass

    1234, 50

    1235, 100

    1236, 75.0

    1237, 100

    1237, 150.0

    1240, 250

    1241, 75

    1241, 100.0

    1241, 125

    1241, 250

];

left join (Temp2)

load LoadNumber,

if(count(LoadNumber)>1, 'DUPLICATE', 'OK') as flag

Resident

Temp2

group by LoadNumber;

1.png

Not applicable
Author

Massimo,

That is excellent!

Thank you,

Steve