title: Django: Self Join on table
body: <p>I wanted to write a query something like this:</p>
  
  <pre><code>SELECT COUNT(a.consumerservicerequestid), YEAR(b.statusdate), MONTH(b.statusDate), AVG(TIMEDIFF(a.statusDate, b.statusdate)) 
  FROM consumer_servicerequest_log a, consumer_servicerequest_log b 
  WHERE a.consumerservicerequestid=b.consumerservicerequestid 
       AND a.status="Parts received" 
       OR b.status IN ("Parts pending","Parts request accepted") 
  GROUP BY YEAR(b.statusdate), MONTH(b.statusdate);
  </code></pre>
  
  <p>Is there a way to do it in Django ORM?</p>