Below is my sample database. I've been trying to get the sum of every code. I will attach my code below
+----+-----------+----------+-------+
| AMOUNT1 | CODE1 | AMOUNT2 | CODE2 |
+---------+-----------+-------------+
| 500 | 023 | 5 | 020 |
| 9203 | 021 | 20 | 021 |
| 200 | 020 | 50 | 023 |
| 50 | 023 | 56 | 023 |
| 100 | 022 | 87 | 022 |
+---------+-------+---------+-------+
SELECT code1, code2
(SUM(amount1)+ SUM(amount2)) as TOTAL,
GROUP BY code1, code2
What I'm trying to do is below
+----+------------+
| TOTAL | CODE1 |
+---------+-------+
| 656 | 023 |
| 9223 | 021 |
| 205 | 020 |
| 187 | 022 |
+---------+-------+