Skip to content
Advertisement

How to sum a column in Postgres

I create this table and inserted in it. I use PostgreSQL. How to write a query to have what i need. I need total amount of each column. below it Thanks.

The below query result in the table “What I have”

enter image description here

What I need is the table “What I want”

enter image description here

Advertisement

Answer

You can use grouping sets for the additional summary.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement