任何人都可以幫助MySQL查詢顯示基於他們的計算多個字段。Mysql查詢多個字段值
,我有以下數據:
ID | Supplier | Total | Tax | Shipping | Paid
1 | 2 | 100 | 10 | 5 | 0
2 | 2 | 50 | 5 | 2.5 | 1
現在我要像下面這樣的結果:如下(迄今爲止)
Supplier | Total Paid | Total Unpaid
2 | 57.5 | 115
我查詢
SELECT suppliers.company, SUM(tax+shipping+total) as unpaid FROM poreceived LEFT JOIN suppliers ON suppliers.id = poreceived.supplierid WHERE paid = '0' GROUP BY supplierid
我不現在如何顯示付費價值。
任何幫助表示讚賞。