I have the following Table:
ID TIME AMMOUNT
1 x 5
2 y 1
2 y 3
3 z 1
3 z 2
3 z 3
But I want it to be like this:
ID TIME AMMOUNT
1 x 5
2 y 4
3 z 6
How can I do this?
CodePudding user response:
Use group by and sum the amount for each group:
select ID, TIME, SUM(AMMOUNT) as AMMOUNT
from table_name
group by ID, TIME
