I have three tables, and each table has the same column information. So I want to join these three tables by their date. But If one of these tables doesn't have date info, then make it zero. I have tried left join three tables, but it doesn't work. P
This table is for a diesel sell table. diesel_data
id | sell_quantity | earn | investment | profit | date
1 | 30 | 300 | 150 | 150 | 15/01/2021
2 | 40 | 400 | 200 | 200 | 15/01/2021
3 | 50 | 500 | 350 | 150 | 18/01/2021
2 | 40 | 400 | 340 | 60 | 19/01/2021
This table is for an octane sell table. octane_data
id | sell_quantity | earn | investment | profit | date
1 | 20 | 200 | 150 | 50 | 15/01/2021
2 | 35 | 340 | 300 | 40 | 18/01/2021
3 | 54 | 530 | 500 | 30 | 18/01/2021
This table is for a Mobil sell table. mobil_data
id | sell_quantity | earn | investment | profit | date
1 | 20 | 240 | 120 | 120 | 15/01/2021
2 | 31 | 310 | 300 | 10 | 16/01/2021
3 | 54 | 540 | 500 | 40 | 18/01/2021
My desire table is that each date has info; if not, fill it with 0 and select the query group by date
My desire table
date|sum(sell_quan(dies)|sum(prof)|sum(sell_qu)oct|sum(prof)oct|sum(sel_qu)mob|sum(prof)mob|
15/01/2021 | 70 | 350 | 20 | 50 | 20 | 120
16/01/2021 | 0 | 0 | 0 | 0 | 31 | 10
17/01/2021 | 0 | 0 | 0 | 0 | 0 | 0
18/01/2021 | 50 | 150 | 89 | 70 | 54 | 40
19/01/2021 | 40 | 60 | 0 | 0 | 0 | 0
20/01/2021 | 0 | 0 | 0 | 0 | 0 | 0
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…