coloque a sua subquery entre parenteses, e coloque um alias, assim:
select sub.campo from (select campo from tabela) as sub;
 


>________________________________
> De: Pedro Costa <[email protected]>
>Para: Comunidade PostgreSQL Brasileira <[email protected]> 
>Enviadas: Terça-feira, 26 de Junho de 2012 13:12
>Assunto: [pgbr-geral] query  erro alias
>  
>Olá pessoal,
>
>Estou a tentar fazer uma query como esta:
>
>
>select the_geom from
>
>(SELECT the_geom
>  FROM arcos
>   JOIN
>   (
>SELECT * FROM shortest_path('
>  SELECT id2 as id,
>  source::int4 AS source,
>   target::int4 AS target,
>    length*estado_actual.custo AS cost
>    FROM arcos, estado_actual
>    where arcos.estado_a = estado_actual.id_ea',
>    438,489,false,false)) AS rota
>   ON
>   arcos.id2 = rota.edge_id)
>
>  using unique id2
>
>
>Mas devolve-me o seguinte erro:
>
>ERROR:  subquery in FROM must have an alias
>LINE 4: (SELECT the_geom
>
>
>Será que podem ajudar a resolver?
>
>Obrigado
>
>
>_______________________________________________
>pgbr-geral mailing list
>[email protected]
>https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
>
>   
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a