how to group by and return sum row in Postgres December 3, 2023 by Tarik SELECT id, SUM(amount) AS amount FROM yourtable GROUP BY id