PostgreSQL group by all fields
09:43 30 May 2018

I have a query like this:

SELECT
table1.*,
sum(table2.amount) as totalamount
FROM table1
join table2 on table1.key = table2.key
GROUP BY table1.*;

I got the error:

column "table1.key" must appear in the GROUP BY clause or be used in an aggregate function

Are there any way to group "all" field?

postgresql