Reputation: 101
So let's say I have data in my query like this:
Name: | Cost:
Oliver 20
Oliver 3
Oliver 2
Sarah 100
Sarah 7
How would I go about merging the data for each person into one row and having a total cost?
Upvotes: 0
Views: 47
Reputation: 133360
you can use group by and sum()
select name, sum(cost)
from your_table
group by name
Upvotes: 1