title: How to compare columns after getting the duplicate records in sql?
body: <p>Let's say we have a column with ID containing duplicates of the same value, how can I then first get the rows of values which are same for that column and then compare the other fields.</p>
  
  <p>For example, in the below table if I can multiple occurrences of id firstly let's say 5 and then compare st date and enddate of same id values like (st date of 1st column &lt;= EndDate of 2nd column) and (st date of 2nd column &lt;= EndDate of 1 st column). I've tried figuring it out but to no avail. please help.</p>
  
  <pre><code>st date | enddate|  id   | date
     123  |  657   | 5      | 20 dec
     123  |  658   | 2      | Null
     124  |  543   | 5      | Null
     124  |  544   | 3333   | 1 Feb
     125  |  098   | 4444   | Null
     125  |  065   | 4444   | Null
  </code></pre>