Ver Mensaje Individual
  #4 (permalink)  
Antiguo 16/12/2010, 09:42
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 3 meses
Puntos: 360
Respuesta: Planteamiento de consulta ¡¡Help!!

Aunque tengo cero (0) conocimientos en POSTGIS veo que haces referencia a 2 tablas y no tienes una condiciones que relacione ambas tablas.

asumiendo que gid es el campo que tienen en común ambas tablas prueba de esta forma.

Código SQL:
Ver original
  1. SELECT  t1.gid, t2.gid, SUM(t1.LENGTH+t2.LENGTH) AS Metros  
  2. FROM tabla t1 INNER JOIN tabla t2    
  3. ON t1.gid=t2.gid
  4. WHERE st_touches(t1.the_geom,t2.the_geom) = 't' -- se tocan
  5. AND t1.LENGTH + t2.LENGTH <= 5500 -- variable
  6. GROUP BY t1.gid,t2.gid,t1.the_geom,t2.the_geom
  7. ORDER BY t1.gid,t2.gid;
__________________
Without data, You are another person with an opinion.
W. Edwads Deming