title: How to compare column to column within one partition
body: <p>I have a table with 7 columns (ID and dates). I need to check if the values rise from the left side of the table. </p>
  
  <p><a href="https://i.stack.imgur.com/6T5BN.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6T5BN.jpg" alt="enter image description here"></a></p>
  
  <p>What I need to do is to compare '2012-07-13' to values in another columns within one partition (sp_id). So e.g I've got to compare '2012-07-13' to '2014-09-01' (the same row) but also '2017-03-12' (the row below). Do you think that there's a solution to do it efficently without a cursor?</p>