title: MySQL finding way in graph of stations that are on different roads
body: <p>I have one little problem.</p>
  
  <p>In my database i have tables:</p>
  
  <pre><code>postaje (id (INT A_I), ime_postaje (VARCHAR), latitude (DOUBLE), longitude (Double))
  
  proge (ID (INT A_I), ime (VARCHAR))
  
  postaje_proge (ID (INT A_I), ID_postaje (INT), ID_proge (INT), stevilo (INT))
  </code></pre>
  
  <p><code>postaje</code> are points (bus stops) on map with longitude and latitude, <code>proge</code> are roads that contains that points and <code>postaje_proge</code> is connection between points and roads (that we know on what roads stations are. <code>stevilo</code> is index of point on road...)
  For example we have in <code>postaje</code> IDs from 1 to 9. in <code>proge</code> IDs 1 (ime aka name of road A) and 2 (B). So in <code>postaje_proge</code> we get: </p>
  
  <pre><code>[ID, ID_postaje, ID_proge, stevilo ] 
  [0,  1,          1,        1] 
  [1,  2,          1,        2]
  [2,  3,          1,        3]
  [3,  4,          1,        4]
  [4,  5,          1,        5]
  [5,  6,          2,        1]
  [6,  7,          2,        2]
  [7,  2,          2,        3]
  [8,  3,          2,        4]
  [9,  8,          2,        5]
  [10, 9,          2,        6]  
  </code></pre>
  
  <p>Now I would like to get Result that returns all points between 1 and 9 in a correct order (so IDs <code>postaje</code> should be this: 1, 2, 3, 8, 9 ). My English is not really good but I hope you will understand what I wanna do :D</p>
  
  <p><img src="https://i.stack.imgur.com/stl75.png" alt="enter image description here"></p>