Re: Como convertir los SELECT que usan AS en otros manejadores a Postrgres

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Orlando Ramirez" <orlan2_r(at)yahoo(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Como convertir los SELECT que usan AS en otros manejadores a Postrgres
Date: 2007-05-11 05:17:35
Message-ID: c2d9e70e0705102217l63c37184tb655af5d6c91f182@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 5/10/07, Orlando Ramirez <orlan2_r(at)yahoo(dot)com> wrote:
>
> En Sybase (usando subsconsultas) la sentencia tiene esta forma:
>
> SELECT distinct(substring(column_id,1,4)) AS columna, (select
> column_description from tabla where column_id=columna) from tabla
> WHERE <condicion>
>
> Pero en Postgres cuando se hace esto el identificador columna definido con
> AS no es reconocido en la subconsulta (¿?).
>

que tal algo como:

select column_id, column_description
from (select substring(column_id from 1 for 4) as codigo
from tabla group by 1) as foo, ctbt010
where column_id = codigo ;

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Magnus Hagander 2007-05-11 08:15:09 Re: [pgsql-es-ayuda] Error SSL en Postgresql
Previous Message Jaime Casanova 2007-05-11 04:49:09 Re: Como contestar a quien se sale del tema del thread (fue:Como convertir los SELECT que usan AS en otros manejadores a Postrgres)