对于sum(base_total - total_discount)在Laravel中是否可能 &g



我的SQL查询是

SELECT SUM(base_total - total_discount) 
FROM orders 
WHERE created_at LIKE '2020-09-18%' 
AND customer_id = 9

那么如何在laravel中编写这个查询

我的Laravel查询这是Order::where('created_at','like','2020-09-18%','and','customer_id','=','9')->sum('base_total','-','total_discount');,其中订单是模型

相关内容

最新更新