Re: ORDER records based on parameters in IN clause

Поиск
Список
Период
Сортировка
От Russell Simpkins
Тема Re: ORDER records based on parameters in IN clause
Дата
Msg-id BAY103-DAV2F286C12D1CD00118F13AB5E00@phx.gbl
обсуждение исходный текст
Ответ на Re: ORDER records based on parameters in IN clause  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-sql
>> when I say
>> select * from table where id IN (2003,1342,799, 1450)
>> I would like the records to be ordered as 2003, 1342, 799, 1450.
>Just say:
>select * from table where id IN (2003,1342,799, 1450) ORDER BY id;
>If that doesn't work, you will have to be more specific and send us the
exact query.

Order by id will not do what you want, but this should.
Select * from table where id = 2003;
Union all
Select * from table where id = 1342;
Union all
Select * from table where id = 799;
Union all
Select * from table where id = 1450;


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

Предыдущее
От: Dawid Kuroczko
Дата:
Сообщение: Re: ENUM like data type
Следующее
От: Dawid Kuroczko
Дата:
Сообщение: Re: ORDER records based on parameters in IN clause