A union does remove duplicate objects. If the objects are different but the values are duplicates of each other, a union will not remove the duplicates. Since your list is retrieved from the database, there will not be any duplicate objects. A retrieve always returns each object once, never twice.
You need custom logic to identify your duplicates and you need to decide which version to keep and qhich to delete.
You also need a delete action to delete the duplicates. Committing the obhects that you keep will not remove the ones you don’t keep.
Here is how its fixed for me , Added both the columns ( concatenated) as a third column.
Used that third column as a list to reiterate/loop and resolve duplicates as in document below.
Now i have unique rows of 2 columns.
This can fixed ‘n’ number of columns by concatenating as third column.