Sounds like the ol "Traveling Salesman" problem. It CAN be done using a recursive CTE (rCTE) with a "stop" in it. I'll see if I can find some old code for this but not tonight. It's 1:30AM and I've gotta take a nap before I get up for work tomorrow (today).
--Jeff Moden
Change is inevitable... Change for the better is not.