I have column(string) comma separated with duplicate values. I want to remove duplicates:
e.g.
column_name
-----------------
gun,gun,man,gun,man
shuttle,enemy,enemy,run
hit,chase
I want result like:
column_name
----------------
gun,man
shuttle,enemy,run
hit,chase
I am using hive database.Please help.
Option 1: keep last occurrence
This will keep the last occurrence of every word.
E.g.
'hello,world,hello,world,hello'
will result in'world,hello'
Option 2: keep first occurrence
This will keep the first occurrence of every word.
E.g.
'hello,world,hello,world,hello'
will result in'hello,world'
Option 3: sorted
E.g.
'Cherry,Apple,Cherry,Cherry,Cherry,Banana,Apple'
will result in'Apple,Banana,Cherry'