Laravel 8 havingRaw / orHavingRaw
2021-07-19 11:11 更新
havingRaw
和 orHavingRaw
方法可以用于将原生字符串设置为 having
语句的值:
$orders = DB::table('orders')
->select('department', DB::raw('SUM(price) as total_sales'))
->groupBy('department')
->havingRaw('SUM(price) > ?', [2500])
->get();
以上内容是否对您有帮助:
更多建议: