我的问题是关于我无法工作的时间间隔。
$totalCount = $datamodel->select('*')
->where('country', 'like', $selectionfield)
->whereBetween('MEASUREDTIME', [$begindatum, $einddatum])
->where('gpsvalid', '=', 1)
-->whereRaw('receivedtime<=(MEASUREDTIME + INTERVAL 10 MINUTE)')
->get();
错误代码:907错误消息:ORA-00907:缺少右括号 位置:195声明:选择*来自(选择*来自人们所在地) &#34; COUNTRY&#34;喜欢:p0和&#34; MEASUREDTIME&#34;之间:p1和:p2和 &#34; GPSVALID&#34; =:p3和接收时间&lt; =(MEASUREDTIME + INTERVAL 10 MINUTE))其中rownum = 1 Bindings:[NL,2017-08-01 00:00:00,2017-08-03 00:00:00,1](SQL:select * from(select * from。) 人们在哪里&#34; COUNTRY&#34;像NL和&#34; MEASUREDTIME&#34; 2017-08-01之间 00:00:00和2017-08-03 00:00:00和&#34; GPSVALID&#34; = 1和 接收时间&lt; =(MEASUREDTIME +间隔10分钟))其中rownum = 1)
答案 0 :(得分:1)
Yuo需要使用原始查询.laravel有whereRaw
方法
$totalCount = $datamodel->select('*')
->where('country', 'like', $selectionfield)
->whereBetween('MEASUREDTIME', [$begindatum, $einddatum])
->where('gpsvalid', '=', 1)
->where('receivedtime', '<=', DB::raw('MEASUREDTIME + INTERVAL 10 MINUTE'))
->get();