Quote:
Look into the traveling salesman problem, branch and bound algorithms ...
Sorry to disagree, it is not a TSP.
Travelling salesman problem - Wikipedia[
^]
It is more like the shortest path problem with a twist.
Dijkstra's algorithm - Wikipedia[
^]
There is no way you can do this in SQL. You have to load the data from the server and apply algorithm.
You have to define what is the shortest path, probably something like the fastest way to go from point a to point B for a given starting time. That is the "cost function"that you need to define.