Laravel Eloquent位于Table的两列之间

时间:2016-11-16 05:50:36

标签: laravel laravel-5 eloquent

Laravel雄辩的问题是什么:

select * from `jobs` where 1 between min_experience and max_experience;

我尝试了以下查询,但是这个用单引号封装了where 1。

Job::whereRaw('? between min_experience and max_experience',1)->get();

select * from `jobs` where '1' between min_experience and max_experience;

3 个答案:

答案 0 :(得分:3)

这可能适合你:

p1 = (49.189787, -67.444574) 
p2 = (24.660845, -67.444574)
p3 = (49.189787, -87.518395) 
p4 = (24.660845, -87.518395) 
p5 = (49.189787, -101.998892)
p6 = (24.660845, -101.998892) 
p7 = (49.189787, -115.236428) 
p8 = (24.660845, -115.236428) 
p9 = (49.189787, -125.242264)
p10 = (24.660845, -125.242264)

答案 1 :(得分:0)

操作员必须这样

level_rank::where('min_pv', '>=', $pv)->where('max_pv', '<=', $pv)->first();

答案 2 :(得分:-1)

Laravel在查询之间有什么工作

Job::whereBetween('max_experience', [1, 1])->get();