我被困在这里。我在Postgres中有这样的行:
id amount a 5000 a 1500 a 500 b 2000 b 1000 c 4000
sql语法如何获得这样的结果?
id amount a 7000 b 3000 c 4000
SELECT id, SUM(amount) AS amount FROM yourtable GROUP BY id