In QGIS 3.18 in a shapefile attribute table, I have some fields with concatenated values (with commas ,
as the delimiter). Some of the values are duplicate, and I would like to remove them.
For example, if an attribute value is 37.3,37.8,44.A2,37.3,37.31,
I'd like an expression that will catch the two instances of 37.3
and remove one of them (without removing the instance of 37.31
which is a different value).
I have not found a simple SQL expression that can do this in the Field calculator, though I am a relative beginner at SQL and Python.
On this site, there are similar questions:
- Removing duplicates from field using ArcPy with ArcMap
- Removing duplicates in lines using PostGIS?
- Removing duplicate strings from field with Field Calculator in ArcMap
but they are rather old, not for QGIS, and ever-so-slightly out of my league (perhaps the formulas are adaptable, but I'm not sure how).