title: Finding max date difference on a single column
body: <p>in the below table example - Table A, we have entries for four different ID's 1,2,3,4 with the respective status and its time. I wanted to find the "ID" which took the maximum amount of time to change the "Status" from Started to Completed. In the below example it is ID = 4. I wanted to run a query and find the results, where we currently has approximately million records in a table. It would be really great, if someone provide an effective way to retrieve this data.</p>
  
  <p>Table A</p>
  
  <pre><code>ID    Status         Date(YYYY-DD-MM HH:MM:SS)
  1.    Started        2017-01-01 01:00:00
  1.    Completed      2017-01-01 02:00:00
  2.    Started        2017-10-02 03:00:00
  2.    Completed      2017-10-02 05:00:00
  3.    Started        2017-15-03 06:00:00
  3.    Completed      2017-15-03 09:00:00
  4.    Started        2017-22-04 10:00:00
  4.    Completed      2017-22-04 15:00:00
  </code></pre>
  
  <p>Thanks!
  Bruce</p>