Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Nested

Status
Not open for further replies.

giahan

Programmer
Sep 1, 2000
139
US
Hi,

I need help on Select Query. I have a table with 3 columns like this:

Start End Distance
A B 10
B C 7
C D 9
D E 11
A C 27
A D 30
E A 42

The problem is to find the possible paths from A to E.
I have to display something like
Path AE 42
Path ADE (AD 30, DE 11)
Path ACDE (AC 27, CD 9, DE 11)
...
.
.

The problems I run into are:
1/. "start" point can be "End" point and "End" point can be "Start" point.
2/. There are hundreds of Start points and End Points.
Any idea or hint is really appreciated.

Thanks in advance




GH
 
You got me on this one. The place I go when I hit the wall on a problem like this, is Joe Celko's SQL for Smarties book. Unfortunatly I lent it to a co-worker. I can't recommend it enought however, for solving problems you were positive could not be done in SQL.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top