[postgis-users] get data from 2 tables and 2 columns fro second table

lisek lichu lisek.lichu at gmail.com
Sun Dec 14 12:20:52 PST 2008


hello i have simple problem but I'm new in SQL so I will as here :P

i have 2 tables


CREATE TABLE points (
id      SERIAL PRIMARY KEY
);
SELECT AddGeometryColumn('','points','the_geom','4326','POINT',2);


CREATE TABLE edges (
id                SERIAL PRIMARY KEY,
start_point_id    INTEGER REFERENCES points (id) ON DELETE RESTRICT ON
UPDATE CASCADE,
final_point_id    INTEGER REFERENCES points (id) ON DELETE RESTRICT ON
UPDATE CASCADE
);

and right now I want to write a query to get in one line id from edges, and
two geometrical points (start and final)
something like this:

select e.id, AsText(p.the_geom) as start, AsText(p.the_geom) as final
   from edges as e,points as p
   where ???

and I dont knoe how to write thi query to get in one line edge ID and two
geometrical points (start and final)

Can somebody help me with that?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20081214/e94359fe/attachment.html>


More information about the postgis-users mailing list