This may be a simple question, I don't know. I'm a real sql newbie...
Here's the problem:
I have a table for registering paths, and it looks somewhat like this:
pathID : NodeID
01 : Node01
01 : Node02
02 : Node01
02 : Node03
03 : Node03
03 : Node04
04 : Node04
04 : Node01
This data illustrates three nodes connected as a triangle like this:
Node1 - Node2 - Node3 - Node04 - Node1
Node1 -01- Node2 -02- Node3 -03- Node04 -04- Node1
What I would like is to get the pathID of a path providing the names of two nodes.
This way I also want to validate if two provided nodes are connected, ie isConnected(Node2, Node4) will return -1 and isConnected(Node1, Node2) will return 01.