Re: Order by behaviour
| От | Raymond O'Donnell |
|---|---|
| Тема | Re: Order by behaviour |
| Дата | |
| Msg-id | 460AE678.2090300@iol.ie обсуждение исходный текст |
| Ответ на | Order by behaviour ("Carlos H. Reimer" <carlos.reimer@opendb.com.br>) |
| Список | pgsql-general |
On 28/03/2007 22:52, Carlos H. Reimer wrote:
> SELECT substr(nomerazao,1,4),
> ascii(substr(nomerazao,1,1)),
> ascii(substr(nomerazao,2,1))
> from spunico.unico order by nomerazao;
You need to add aliases to the returned column by which you'd like to
order the result: your query is ordering the rows according to the
column "nomerazao" in the original table, rather than by the substr()
value returned.
Do something like this:
SELECT substr(nomerazao,1,4) AS my_col,
ascii(substr(nomerazao,1,1)),
ascii(substr(nomerazao,2,1))
from spunico.unico order by my_col;
HTH
Ray.
---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------
В списке pgsql-general по дате отправления: