Skip to content
Advertisement

How to group by and sum in sql

I have tables like following one I’d like to extract customers who has product=a

And then, I’d like to sumthe score by each customer.

Therefore my desired result is like following Are there any way to achieve this?

My work is like below. I’d like to know next step

Thanks

Advertisement

Answer

You would need an aggregate (GROUP BY) and a SUM(t1.score)

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement