Re: How to sort strings containing a dot?

From: Pierre LEBRECH <pierre(dot)lebrech(at)laposte(dot)net>
To: Adam Rich <adam(dot)r(at)sbcglobal(dot)net>
Cc: "'Roberts, Jon'" <Jon(dot)Roberts(at)asurion(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: How to sort strings containing a dot?
Date: 2008-03-25 16:58:28
Message-ID: 47E92F34.40006@laposte.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks Adam. No, It doesn't.

But I have found a solution which works :

select name from (select distinct name from t) as name order by replace(name, '.', 'a');
name
----------
co.aaa
co.abb
co.cab
co.ment
com
com.enta
(6 lines)

Thanks to all of you.

Adam Rich wrote :
>> By the way, I have just inserted a duplicate. Then I have run the
>> select statement with distinct and I got an error.
>>
>> How one can solve this?
>>
>
> Does this work?
>
> select distinct name
> from ( select name from t order by replace(name, '.', 'a')) as t2
>
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roberts, Jon 2008-03-25 17:07:14 Re: How to sort strings containing a dot?
Previous Message LARC/J.L.Shipman/jshipman 2008-03-25 16:49:32 pg_ctrl stop problems (psql 8.2.5)