图集1/1

正文 537字数 2,054,408阅读

1.在laravel查询中,我们需要查找两个字段相等的值,这种方法不行
$data = DB::connection('mysql_branch')->table('branches') ->where('is_usable',1) ->whereRaw('money','amount')->get();
Run code
Cut to clipboard


    2.这种也不行
    $first_agent = DB::connection('mysql_branch')->table('branches') ->where('is_usable',1) ->whereRaw('money','=','amount')->get();
    Run code
    Cut to clipboard


      3.需要这样查询
      $first_agent = DB::connection('mysql_branch')->table('branches') ->where('is_usable',1) ->whereRaw('money=amount')->get();
      Run code
      Cut to clipboard