0
列出客戶的名字,姓氏和花費總金額(注意:花費的金額是訂單小計+稅金+從tblorder表中發貨的成本)。Mysql select總計和名稱
我有這樣的代碼(但值都出來一樣:
Select CONCAT(firstname, ' ' ,lastname) as name, sum(ordersubtotal + ordertax + ordershipcost) as AmountSpent
From tblorder,tblcust
group by name
嘗試把你的表之間的連接條件。作爲一條規則:不要在'from'子句中使用逗號。始終使用明確的「加入」。 – 2015-04-02 03:11:04
idk要加入的是它的名稱和custid? – runlax 2015-04-02 03:15:54