title: Complete datediff calculation based on MAX and MIN values
body: <p>Sorry I did post a question similar earlier, but I was not that clear.  I have a table with the fields, Customer, ID_Date, Pstng_Date, SUMOfAmount, Days_BetweenMax and days_between Min.</p>
  
  <p>What I want is a query that shows me the date difference between the pstng_date and the ID_Date where the pstng_date is the max value for that customer and another column that shows the same calculation where the pstng_date is the minimum value for that customer. Those customers with only one Pstng_date should display as zero</p>
  
  <p>So the Query should display the results like this:</p>
  
  <pre><code>Customer ID_Date    Pstng_Date SumOfAmount Days_BetweenMAX days_betweenMIN
  -------- ---------- ---------- ----------- ------------
  Holmes   31/01/2014 10/01/2014  $21,545.59            0       0
  James    31/01/2014 10/01/2014 -$21,197.89            0       21
  James    31/01/2014  5/01/2014  -$7,823.14            0       0
  James    31/01/2014 24/01/2014     $308.00            7       0
  Rod      31/01/2014 17/01/2014  -$2,603.95            0       0
  Lisa     31/01/2014 17/01/2014  $22,019.49            0       0
  </code></pre>