title: How to use GROUP BY in Django ORM
body: <p>I am stuck in a situation where I need an equivalent <strong>Django ORM</strong> for the following sql query. Please help, I am new to django.</p>
  
  <pre><code>SELECT column1, column2, sum(column3) as total
  FROM table1
  GROUP BY column1;
  </code></pre>
  
  <p>I have tried 
  <code>Table1.objects.values('column1', 'column2').annotate(total=Sum(column3))</code> 
  Which makes the above orm as this:</p>
  
  <pre><code>SELECT column1, column2, sum(column3) as total
  FROM table1
  GROUP BY column1, column2;
  </code></pre>
  
  <p>It is grouping column1 and column2 which I dont want.</p>