I’ve searched and tried for long hours, and can’t seem to get what I need.
I have a table of accounts as a tree -parents and children-, only leaf accounts can have transactions, any parent will NOT have debits and credits itself.
My fiddle of data is here
What I need is to show sum of “Debits of children” and sum of “Credits of children” in their parent’s row, like this picture:
How can I do it in MySql?