Re: Ordering a name list and ignoring whitespace - Mailing list pgsql-sql

From Mario Splivalo
Subject Re: Ordering a name list and ignoring whitespace
Date
Msg-id 49E71054.1030607@megafon.hr
Whole thread Raw
In response to Ordering a name list and ignoring whitespace  (Mikel Lindsaar <raasdnil@gmail.com>)
List pgsql-sql
Mikel Lindsaar wrote:
> Hi all,
> 
> Doing some googling and looking through the docs, I can't find an
> obvious way to do this beside post processing after the query (which I
> am trying to avoid).
> 
> I'm trying to select a list of names in alphabetical order but
> ignoring the whitespace.
> 
> So for example, the name "La Combe" should come after "Lace" but
> before "Lacs..."
> 
> Any ideas?

Could you do it like this:

SELECT       replace(name_column, ' ', '') AS name_replaced
FROM       your_table_name
ORDER BY       name_replaced

This can get a bit slowish if your table has quite a number of rows.
Mike


pgsql-sql by date:

Previous
From: Mikel Lindsaar
Date:
Subject: Ordering a name list and ignoring whitespace
Next
From: ShuA
Date:
Subject: Need a script that bakes INSERT script from SELECT results