What about something like this.
SELECT a.to_point, a.in_size, b.out_size
FROM
(SELECT to_point, max(size) AS in_size FROM links GROUP BY to_point) AS a,
(SELECT from_point, size AS out_size FROM links) AS b
WHERE a.to_point = b.from_point
AND b.out_size < a.in_size;
-- Kevin
Broun Uganda wrote:
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 Learn more!
<http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE>
------------------------------------------------------------------------
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users