Obrigado pessoal..
Já entendi...
fiz isto:
select rota2.the_geom, rota2.id from
(SELECT id, 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) AS rota2
using unique id
Sem o using funciona mas com o using obtenho o seguinte erro:
ERROR: syntax error at or near "using"
LINE 27: using unique id
Em 26-06-2012 17:50, Jean Domingues escreveu:
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]
<mailto:[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
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral