阅读(3509)
赞(7)
Laravel 8 havingRaw / orHavingRaw
2021-07-07 09:14:21 更新
havingRaw
和 orHavingRaw
方法可以用于将原生字符串设置为 having
语句的值:
$orders = DB::table('orders')
->select('department', DB::raw('SUM(price) as total_sales'))
->groupBy('department')
->havingRaw('SUM(price) > ?', [2500])
->get();