laravel sum 多個字段

laravel中怎麼實現下面的SQLhtml

select sum('profit'),sum('order_count') from pro where......;laravel

 

參考code

self::where('id', $id)->first(
    array(
        \DB::raw('SUM(profit) as profit'),
        \DB::raw('SUM(order_count) as order_count')
    )
)->toArray();

 轉載:https://www.cnblogs.com/xiaozong/p/5949623.html#undefinedhtm

相關文章
相關標籤/搜索