ORDER BY using specifc values

Поиск
Список
Период
Сортировка
От Ian McWilton
Тема ORDER BY using specifc values
Дата
Msg-id 200004122331.QAA05037@hedley.blazingcactus.com
обсуждение исходный текст
Ответы Re: ORDER BY using specifc values  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: ORDER BY using specifc values  (Oliver Mueschke <o@mueschke.de>)
Список pgsql-sql
Hi there,

I need to return the results of a SELECT ordered by a 
column but in a way that is neither ascending or 
descending. 

The ORDER BY column can have one of five values and I 
want to specify which values are returned in the list 
in which order.

An example table below shows the data in the DB:

INDEX | VALUE
1, A
2, B
3, B
4, C
5, B

...and what I want is for my queries result to be 
ordered by VALUE with C put first in the list, then A, 
then B.

Having investigated it appears that ORDER BY does not 
seem to be any help as it restricts the ordering to ASC 
or DESC.

The onyl solution I can see isn't at all elegant; issue 
five SELECT statements in sequence and construct one 
list from this five

Does anyone know of another way to do what I want in 
one query?

Regrads,



Ian McWilton.


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

Предыдущее
От: "tjk@tksoft.com"
Дата:
Сообщение: Re: Localization or an other solution
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Localization or an other solution