Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...
Дата
Msg-id 200202202147.g1KLl9p13545@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: Ordering 'A', 'B', ..., 'Z', 'AA', 'AB', ...  (Charles Albrecht <charlesa@pobox.com>)
Список pgsql-general
> ORDER BY
>     CASE WHEN TABLE.MYCOLUMN LIKE '__'
>          THEN TABLE.MYCOLUMN
>          ELSE ' ' || TABLE.MYCOLUMN END
>
> The syntax may be a little different in pg, though.
>
> It's also easy enough to do in Perl with a custom sort sub.

In PostgreSQL, you would need to create a column with the CASE, the
order by that using the column number or AS to name the column and order
on that name.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

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

Предыдущее
От: Vivek Khera
Дата:
Сообщение: Re: schema error upgrading from 7.1 to 7.2
Следующее
От: "Kevin Old"
Дата:
Сообщение: test