📌  相关文章
📜  DB::raw('SUM(subtotal) as total sales', 'SUM(discount) as d') - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:46.079000             🧑  作者: Mango

代码示例1
$customer = FinanceSale::select(
  DB::raw('SUM(sub_total) as total_sales'),
  DB::raw('SUM(discount) as d'),
)
->where('customer_id', $id)
->groupBy('customer_id')
->first();