Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
The data:
ID, SEQ, NAME
1,1,A
1,2,A
1,3,A
1,4,A
1,5,A
2,1,B
2,2,B
2,3,B
2,4,B
Is it possible to merge the rows with same ID together following the sequence column? The result should be something like this:
ID, MergedName
1, A1A2A3A4A5
2, B1B2B3B4
The concat() function already supports giving it a sequence, so there's no need for additional steps for the sort.
LOAD ID,concat(NAME,'',SEQ) as NAME
INLINE [
ID, SEQ, NAME
1,1,AA
1,2,AB
1,3,AC
1,4,AD
1,5,AE
2,4,BD
2,3,BC
2,2,BB
2,1,BA
]
GROUP BY ID;
Hi tauqueer,
I tried this method, but for some unknown reason, it doesn't work correctly for my real data. The merged result is still not in the sequential format.
I edited Karl's script a bit and it is working fine now! Thanks Karl for the code!
Thanks to all for all the suggestions!