04-18-2019 12:53 AM
Hi everyone,
I am listing database rows, and some could be duplicated with a newer version:
eg:
Col 1, Col 2, Col 3
124, 1, 0
124, 2, 0
124, 1, 1
124, 2, 1
I need to only keep the 2 last rows, which are the one with the Col3 being the maximum as it corresponds to a version number, and exclude the others.
Does anyone have an idea on how I can do this? I did look with Group By but I am not quote sure how to use it.
Thanks,
05-09-2019 05:46 AM
Hi Eric,
Yes, this can be done using the Group by snap. Before that you should use Sort snap, and for the example above, Sort paths should be $Col1 and $Col2. After that in the Group by fields snap, you are adding these 2 fields $Col1 and $Col2. If you are sure that version numbers in Col3 will be always sorted in increasing order you can return (filter) the last element from the group array (in this case element with the highest version number - Col3) using the mapper snap with pop function.
Regards, Ljupcho