将BETWEEN的mysql查询转换为laravel查询

时间:2015-11-10 08:08:40

标签: php mysql laravel

请建议如何继续执行laravel的mysql查询

SQL

test()

这是我试过的

SELECT * FROM shifts
WHERE  time_sheet_id = 11 AND ( "14:00" BETWEEN shift_start_time AND shift_end_time
   OR "15:00" BETWEEN shift_start_time AND shift_end_time
   OR "14:00" >= shift_start_time AND "15:00" <= shift_end_time )

我得到了这个错误:(请咨询

 $shiftData = Shifts::where('time_sheet_id', '=', $getTimesheet1->time_sheet_id)
            ->where('user_id', '=', $user_id->user_id)
            ->where('role_id', '=', 1)
            ->whereBetween(Input::get('shift_start_time'), array('shift_start_time ' , 'shift_end_time '))
            ->whereBetween(Input::get('shift_end_time') , array('shift_start_time ' , 'shift_end_time '))
            ->where( Input::get('shift_end_time'), '>=', 'shift_start_time ')
            ->where(Input::get('shift_end_time'), '<=',  'shift_end_time ')
            ->get();

更新:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '18:00:00' in 'where clause' (SQL: select * from `shifts` where `time_sheet_id` = 12 and `user_id` = 2 and `role_id` = 1 and `18:00:00` between shift_start_time and shift_end_time and `20:00:00` between shift_start_time and shift_end_time and `20:00:00` >= shift_start_time and `20:00:00` <= shift_end_time )

0 个答案:

没有答案