Query on a network

hangglide

Hangglider
Local time
Today, 00:38
Joined
May 9, 2001
Messages
35
Is it possible to write a query on a network table (not a computer network).

For example:

Streams flow into larger streams. Each stream has a nodeID at the top and bottom. So one stream from its headwater migh flow (simplisticly) from node 1 to 2, then from 2 to 3 and from 3 to 4. A second stream might flow from node 8 to 9 and from 9 to 4 (joining the previous stream). Then together they flow from node 4 to 11.

The table looks like this:

Stream(SegmentID, FromNodeID, ToNodeID)

Example data:
a, 1, 2
b, 2, 3
c, 3, 4
d, 8, 9
e, 9, 4
f, 4, 11

and so on for about 100,000 records (the whole state).

I want to write a query on this table that will return all the upstream segments for a given record (SegmentID).

For example, tell me all the upstream segments from c:
Answer: a and b (because c is connected to b and b is connected to a).

Any help would be appreciated.

Thanks,
Leo
 

Users who are viewing this thread

Back
Top Bottom