Skip to content
Advertisement

How to calculate the difference between multiple rows in SQL

Users

Transactions

The newBalance is the sum of all amounts to this date and the newTotal is the sum of all positives amounts to this date.

I want to order who has made the most money this week

Result Desired :

How do I write that in SQL?

Advertisement

Answer

You can sum up your amount filtering for this week and order the results:

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