Re: [GENERAL] reverse sorting

Поиск
Список
Период
Сортировка
От Mark Jewiss
Тема Re: [GENERAL] reverse sorting
Дата
Msg-id Pine.BSO.4.10.10001270844190.5186-100000@office.knowledge.com
обсуждение исходный текст
Ответ на reverse sorting  (Marc Tardif <admin@wtbwts.com>)
Список pgsql-general
Hello,

On Wed, 26 Jan 2000, Marc Tardif wrote:

> I need to sort the domains of email addresses from right to left, so that
> all similar domains are grouped together. For instance, all .ca's will be
> in the same batch.

> select email from table1, table2 where table1.oid=table2.id order by
> table2.reverse_domain;

Hmmmm.....you don't really want to sort by the reverese domain though. If
you did, you'd end up sorting on ac. instead of .ca, so simply reversing
the string would not work.

Splitting the string on the '.' might also prove a problem as you could
have .ca and .co.uk for example.

One solution (that you probably don't want to hear - I know I wouldn't) is
to change the table to store the domain in separate parts - one column for
the user, one for the domain and one for the domain suffix.

Regards,

Mark.
--
Mark Jewiss
Knowledge Matters Limited
http://www.knowledge.com


В списке pgsql-general по дате отправления:

Предыдущее
От: Jim Mercer
Дата:
Сообщение: finding last element of an index
Следующее
От: "Marc"
Дата:
Сообщение: how to: list of synonyms (Oracle)?