我试图将下面的mysql查询转换为laravel等效。
select email from emails
order by call_count + receive_count desc;
到Laravel
DB::table('emails')
->select('email')
->orderBy(SUM('call_count','receive_count'), 'DESC')
->get();
请让我知道..谢谢
答案 0 :(得分:2)
试试这个
DB::table('emails')
->select('email')
->orderBy(DB::raw("`call_count` + `receive_count`"), 'desc')
->get();