From: | Raymond O'Donnell <rod(at)iol(dot)ie> |
---|---|
To: | carlos(dot)reimer(at)opendb(dot)com(dot)br |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Order by behaviour |
Date: | 2007-03-28 22:04:40 |
Message-ID: | 460AE678.2090300@iol.ie |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)iol(dot)ie
---------------------------------------------------------------
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2007-03-28 22:05:14 | Re: Order by behaviour |
Previous Message | Carlos H. Reimer | 2007-03-28 21:52:04 | Order by behaviour |