Re: ORDER BY

Поиск
Список
Период
Сортировка
От George Pavlov
Тема Re: ORDER BY
Дата
Msg-id 8C5B026B51B6854CBE88121DBF097A865D43BB@ehost010-33.exch010.intermedia.net
обсуждение исходный текст
Ответ на Re: ORDER BY  (Alexander Staubo <alex@purefiction.net>)
Ответы Re: ORDER BY  (John Sidney-Woollett <johnsw@wardbrook.com>)
Re: ORDER BY  (Alban Hertroys <alban@magproductions.nl>)
Re: ORDER BY  (Chris Mulcahy <pgsql@cmulcahy.com>)
Список pgsql-general
> For larger tables, you may have to resort to a
> union:
>
>    select * from foo where name != 'Other' order by name
>    union
>    select * from foo where name = 'Other'

Alas, this suggestion is wrong on two counts: (a) UNION expects a single
ORDER BY that applies to the whole recordset and which has to come at
the end; (b) UNION re-sorts anyway (it needs to eliminate the dupes) --
maybe you are thinking UNION ALL? So, to follow your advice he may want
a query like this, although it seems quite silly and there still isn't
an ironclad guarantee re. the final result sorting:

select * from
  (select * from foo where name != 'Other' order by name) x
union all
select * from foo where name = 'Other'

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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Using SAN Splits to instantly copy a DB
Следующее
От: "Morris Goldstein"
Дата:
Сообщение: Transaction id wraparound problem