Sql query statement

A table with transaction numbers, borrowers, lenders, and the amount of money borrowed. A person can borrow money from multiple people, or lend money to multiple people. The need is to display a table to the front desk. The horizontal title of this table is borrowed money, the column is introduced to the person, the middle is the amount of each transaction, and the total amount of statistics

Sql
Apr.02,2021

the data structure in the database is very clear. The problem that does not need to be solved by sql at all is how to show it at the front end

a -> b  1000
b -> c  550
a -> d  200
a -> e  300
c -> f  300
Menu