title: Can not get correct previous and next rows in SQL Server 2008
body: <p>I am new to this forum and new to SQL. Can you please help me with the foloowing:</p>
  
  <p>I have a table with all transactions. I want to find each transaction's Start date and End date with respect to Transaction_By(i.e., User).</p>
  
  <p><a href="https://i.stack.imgur.com/60zGO.jpg" rel="nofollow noreferrer">My table and results:</a></p>
  
  <p>I tried using the below query but not giving the correct results. </p>
  
  <p><a href="https://i.stack.imgur.com/N1OVq.jpg" rel="nofollow noreferrer">My code</a></p>
  
  <p>Thanks in advance.</p>
  
  <p>Hi,
  Sorry, I am totally new to this forum, so not sure how to add image for my second query. Please find my new query data and expected results here.</p>
  
  <p><a href="https://i.stack.imgur.com/QhTgV.jpg" rel="nofollow noreferrer">My new query data and expected results are here</a></p>
  
  <p>Thanks once again.</p>
  
  <p>Hi Andrei,
  Please find my new data along with my expected results here.</p>
  
  <p>New data link:
  <a href="http://sqlfiddle.com/#!18/8e49b/1/0" rel="nofollow noreferrer">http://sqlfiddle.com/#!18/8e49b/1/0</a></p>
  
  <p>Expected results:<a href="https://i.stack.imgur.com/U50yI.jpg" rel="nofollow noreferrer">My new data's expected result</a></p>