Skip to content
Advertisement

My SUM query returns 2 rows, need some advise

I am getting 2 rows(9500) for 111 in the result, could you please advise on the right approach, I need like, Balance = (sum of bought – sum of sold)

Query

Advertisement

Answer

You can use conditional aggregation:

If you want this for only one account, you can add a where clause:

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