I have three tables user, deposit and withdraw.
user:
| id | name |
| -: | :------ |
| 1 | Lorem |
| 2 | Ipsum |
| 3 | Dolores |
deposit:
user_id | amount
------: | -----:
1 | 1000
3 | 3000
withdraw:
user_id | amount
------: | -----:
1 | 2000
2 | 3000
My question is how to join the table, expected result:
id | sum_deposit | sum_withdraw
-: | -----------: | ------------:
1 | 1000 | 2000
2 | null | 3000
3 | 3000 | null