我想转换此查询
select sum(TIME_TO_SEC(`duration`)) from `table`
对Laravel 5的Eloquent ORM
答案 0 :(得分:0)
我不确定在什么情况下,但如果我找到你,你想要
select sum(TIME_TO_SEC(`duration`)) from `table`
是
DB::table('table')
->select(DB::raw('sum(TIME_TO_SEC(`duration`))')
->get();
答案 1 :(得分:0)
它适用于我:
Table::selectRaw('sum( TIME_TO_SEC(`duration`) ) as duration')->first();