My question is similar to this but the answer is not what I want:
Cannot use group by and over(partition by) in the same query?
My table is like this:
CODE_1 CODE_2 AMOUNT
A A.1 2
A 4
A 6
B 1
B B.1 3
B B.1 5
I want to get the total of Code_1 and [Code_1, Code_2] like this:
CODE_1 CODE_2 Total_1 Total_2
A A1 12 2
B B1 9 8
Can I get the result in one SELECT? Thanks!