[postgis-users] Compare data in one table

Broun Uganda tekuganda at hotmail.com
Fri Aug 29 14:23:33 PDT 2008

I am trying to develop a trigger function that searches for lines with particular properties. I have two or more lines joining at a point but only one line exiting from that point. I want to check that the size of the outgoing (exiting) line is always not smaller than incoming lines.
Take such data as example:
line_name from_point to_point size
line1        p1              p2          2
line2        p10             p2         3
line3        p2            p7            1
line4        p7            p8            3

Lines Line1 and Line2 join at point p2 (to_point), therefore line3 should have size at least equal to 3.
Tried to use this select statement but doesnt work, could anyone give me an idea
Select link_name, diameter, from_node, to_node from links as ends where ends.diameter< links.diameter;
or even
SELECT   from_node from links as dstream  intersect SELECT   to_node from links as previo ;

Thank you

Broun Uganda

Discover the new Windows Vista
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080830/12a4530c/attachment.html>

More information about the postgis-users mailing list