Re: order by question

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: order by question
Дата
Msg-id 87mztc7r9r.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: order by question  (Gary Stainburn <gary.stainburn@ringways.co.uk>)
Список pgsql-sql
Gary Stainburn <gary.stainburn@ringways.co.uk> writes:

> > Alternatively: (a<>6),(a<>4),a
> 
> Although this does exactly what I want, at first glance it should do 
> exactly the opposite.
> 
> I'm guessing that for each line it evaluates
> not (a=6) 0 for true else 1

Not really, "not a=6" is an expression that evaluates to a boolean, true or
false. true sorts as "greater" than false. That order is counterintuitive but
it's because the default sort order is ascending. So the "lesser" false
records appear first.

If you put "not a=6" in your select column list you'll see the true and false
values appear.


-- 
greg



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

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: Table like a field
Следующее
От: Stef
Дата:
Сообщение: Re: [SOLVED] Postgres schema comparison.