title: How to select row index in MSSQL
body: <p>I have a table that contains three fields: Top(int), Left(int), Text(varchar).</p>
  
  <p>The data inside the table are as following:</p>
  
  <pre><code>Text      X       Y
  
  1       1000    250
  
  2        700    100
  
  A        618    300
  
  B        620    400
  
  C        625    405
  
  F        623    402
  
  D        400    410
  
  M        300    415
  
  Z        304    418   
  </code></pre>
  
  <p>I want to get all the "Text" <code>where (X - previous X) &lt; 10 and (Y - previous Y) &lt; 10</code></p>
  
  <p>The result in this case should be: B, C, F, M, Z</p>
  
  <p>Is it possible to to do that with SQL?</p>
  
  <p>Thank you in advance</p>