title: SQL Server: difference in days for two dates in separate rows
body: <p>I am using SQL Server 2012 and working an a report currently that is asking me to find the difference in days between two dates.</p>
  
  <p>Basically, for a particular <code>ReportID</code>, I'm trying to find the difference in days between the (<code>ReportCompletedDate</code> when the <code>ReportType = 'PaperReceived'</code>) - (<code>ReportCompletedDate</code> when the <code>ReportType = 'Form Completed'</code>)</p>
  
  <p>I tried to give some records below...</p>
  
  <pre><code>ReportID   ReportType       ReportCompletedDate  
  -------------------------------------------------
  450        PaperReceived      9/5/2013
  450        Form Completed     8/13/2013
  451        PaperReceived      9/7/2013
  451        Form Completed     7/12/2013
  452        PaperReceived      10/6/2013
  452        Form Completed     3/13/2013
  </code></pre>
  
  <p>So, for <code>ReportID = 450</code> for example, I want to get <code>9/5/2013 - 8/13/2013</code> in days. </p>
  
  <p>If anyone also knows how to do this for calendar days and business days, that would be awesome...but at least calendar days should be fine.</p>
  
  <p>I'm not sure how to go about this, usually when the two dates are in line, it's easier for me to figure out, but not sure how to go about it when the dates are in separate rows. Any advice would be gladly appreciated.</p>