我有两个表Users和db_ips,我需要比较用户的经纬度与db_ips表的两个三个小数点的值与纬度,为此我在laravel中写了查询.
null $operator = null, string
$users = \DB::table('users')
->select("id", "latitude", "longitude")
->Join('IPAddress AS IP', \DB::raw('ROUND(IP.lat,3)'), '=', \DB::raw('ROUND(users.latitude,3)'))
->where('users.login_tries', "=", 0)
->where('users.latitude', "<>", "")
->whereNotNull('users.latitude')
->orderBy("id", "ASC")->limit(100)->get();
return !$users->isEmpty() ? $users : [];
对于两个三位小数的比较,我在join中使用了ROUND medthod,但是当我运行查询时,我得到的不是结果,而是下面的错误。
错误
函数Illuminate/Database/\Query/Builder::join()的参数太少,在homerizwanphpfayvoarchiveappConsoleCommandsSyncUserLocat ion.php的第139行传递了1个参数,至少有2个预期参数。
我也试着进行原始查询,但在field_list中收到未知column_name的错误信息。
join(string $table, string $first, string