I have a big table (1M rows) with the following columns: source, dest, distance. Each row defines a link (from A to B).
I need to find the distances between a pair using anoter node. An example: If want to find the distance between A and B, If I find a node x and have: x -> A x -> B I can add these distances and have the distance beetween A and B. My question: How can I find all the nodes (such as x) and get their distances to (A and B)? My purpose is to select the min value of distance.
P.s: A and B are just one connection (I need to do it for 100K connections). Thanks !
To select rows using selection symbols for character or graphic data, use the LIKE keyword in a WHERE clause, and the underscore and percent sign as selection symbols. You can create multiple row conditions, and use the AND, OR, or IN keywords to connect the conditions.
You can just do Select * from table. It will select entire data from your table.
As Andomar said, you'll need the Dijkstra's algorithm, here's a link to that algorithm in T-SQL: T-SQL Dijkstra's Algorithm
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With