title: PostgreSQL group by all fields
body: <p>I have a query like this:</p>
  
  <pre><code>SELECT
  table1.*,
  sum(table2.amount) as totalamount
  FROM table1
  join table2 on table1.key = table2.key
  GROUP BY table1.*;
  </code></pre>
  
  <p>I got the error:  column "table1.key" must appear in the GROUP BY clause or be used in an aggregate function.<br>
  Are there any way to group "all" field?</p>