我有一张销售订单和采购订单的表格。
销售订单
Date Amount
26/10 120
26/10 130
26/10 50
27/10 50
27/10 60
采购订单
Date Amount
26/10 200
26/10 300
26/10 100
27/10 100
27/10 100
我想按日期显示总销售额和总购买量。
例如
Date Total Sales Total Purchases
26/10 300 600
27/10 110 200
我的 SQL 查询是这样的,但它不起作用。
$query = "Select o.date, o.Amount AS Sales, p.date, p.Amount AS Purchases
From customerorder o
right join Purchaseorder p on o.date = p.date
order by o.date";
请帮忙!谢谢!