Skip to content
Advertisement

mysql – running sums for multiple categories with group by clause

I have this table:

This query:

has a result:

Now, when I used “group by” clause:

It gives me an error. I am using mysql 5.7, so window function or “sum() over” cannot be used. Below is my desired output. Would this be possible?

Also, if I will query with trans_date between ‘2019-08-28’ and ‘2019-08-29’, this will be the desired output:

Advertisement

Answer

Try this below code

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