Re: Ordering a name list and ignoring whitespace

Поиск
Список
Период
Сортировка
От Mario Splivalo
Тема Re: Ordering a name list and ignoring whitespace
Дата
Msg-id 49E71054.1030607@megafon.hr
обсуждение исходный текст
Ответ на Ordering a name list and ignoring whitespace  (Mikel Lindsaar <raasdnil@gmail.com>)
Список 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 по дате отправления:

Предыдущее
От: Mikel Lindsaar
Дата:
Сообщение: Ordering a name list and ignoring whitespace
Следующее
От: ShuA
Дата:
Сообщение: Need a script that bakes INSERT script from SELECT results