title: SQL query to find the shortest route between 2 points
body: <p>I have a table that has three fields: <code>Origin</code>, <code>Destination</code> and <code>Distance</code>.</p>
  
  <p>How can I write a query to find the shortest route from origin to destination?</p>
  
  <pre>
   Origin     Destination        Distance 
  -----------------------------------------
     A             B                 10
     B             C                 20
     C             E                 30
     B             F                 5
     F             E                 6
  </pre>
  
  <p>For example we want the shortest route from C to F the answer will be :</p>
  
  <pre>
       C---->F
  C---->B then B---->F
  </pre>