SUMで合計を求めることが出来る。
https://www.postgresql.jp/docs/9.4/functions-aggregate.html
postgresdb1=# SELECT * FROM products;
id | name | price | tax | quantity | discount
----+------------+--------+-------+----------+----------
1 | ペン | 100.00 | 10.00 | 50 | 5.00
2 | ノート | 200.00 | 10.00 | 10 | 3.00
3 | ペンケース | 250.00 | 10.00 | 10 | 3.00
3 | 消しゴム | 50.00 | 10.00 | 5 | 8.00
(4 行)
postgresdb1=# SELECT SUM(price * quantity) AS total_sales FROM products;
total_sales
-------------
9750.00
(1 行)
postgresdb1=#売上合計total_salesを出せた。