Search Postgresql Archives

Re: inconsistency in aliasing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Wed, 1/14/09, Louis-David Mitterrand <vindex+lists-pgsql-general@xxxxxxxxxxx> wrote:

> From: Louis-David Mitterrand <vindex+lists-pgsql-general@xxxxxxxxxxx>
> Subject: Re:  inconsistency in aliasing
> To: pgsql-general@xxxxxxxxxxxxxx
> Date: Wednesday, January 14, 2009, 11:27 AM
> On Wed, Jan 14, 2009 at 12:06:47PM +0100, A. Kretschmer
> wrote:
> > In response to Louis-David Mitterrand :
> > > Hi,
> > > 
> > > This works:
> > > 
> > > 	critik=# select current_timestamp::abstime::int4
> as score order by score;
> > > 
> > > This doesn't:
> > > 
> > > 	critik=# select current_timestamp::abstime::int4
> as score order by score + 1;  
> > > 	ERROR:  column "score" does not exist
> > > 	LINE 1: ...urrent_timestamp::abstime::int4 as
> score order by score + 1 ...
> > > 
> > > Any idea ?
> > 
> > Yes, you can't use the alias in the ORDER BY. Use
> the real column-name.
> > 
> > select current_timestamp::abstime::int4 as score order
> by
> > current_timestamp::abstime::int4;
> 
> Did you try
> 
> "select current_timestamp::abstime::int4 as score
> order by score;" ?
> 
> This seems to be an "order by <alias>"
> 
> -- 
> http://www.critikart.net
> 

you can't use operator in the group by, try this

select score,score+1 as score2 from (
select current_timestamp::abstime::int4 as score)
order by score2


      


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux