Sorting CSV string and removing Duplicates

From: Alex Magnum <magnum11200(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Sorting CSV string and removing Duplicates
Date: 2015-07-27 19:53:03
Message-ID: CA+cR4zeD9tK+vYwVHBTY_fO0EN_-9dzcTsrRf=2XL6nmdpAKqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

I have a csv string in a text field that is unsorted and contains
duplicates.
Is there a simple way to remove these and sort the string.

E.g
2,18,20,23,1,27,1,2,8,16,17,18,20,22,23,27

i tried string to array and unique but that did not work...
Any suggestions on how to do this without writing a function?

Any help is appreciated.

Thanks
A

Responses

Browse pgsql-general by date

  From Date Subject
Next Message dinesh kumar 2015-07-27 19:57:02 Re: Sorting CSV string and removing Duplicates
Previous Message Adrian Klaver 2015-07-27 19:41:41 Re: Problems with timezone