Php Laravel和SQL,其中或何处不';不限制
我觉得这很简单,但让我有点疯狂 我有这个:Php Laravel和SQL,其中或何处不';不限制,php,sql,laravel,Php,Sql,Laravel,我觉得这很简单,但让我有点疯狂 我有这个: Transaction:: where('seller_id', $this->id)-> Orwhere('buyer_id', $this->id )-> whereIn('concept', ['Lemonway','Paypal'])-> where('status', '=', 'ok') ->get(); 因此,如果我明确指定status='ok' 为什么选择一个
Transaction::
where('seller_id', $this->id)->
Orwhere('buyer_id', $this->id )->
whereIn('concept', ['Lemonway','Paypal'])->
where('status', '=', 'ok')
->get();
因此,如果我明确指定status='ok'
为什么选择一个状态=挂起的交易
?您需要使用参数分组,例如:
Transaction::where(function($q) {
$q->where('seller_id', $this->id)
->orwhere('buyer_id', $this->id)
->whereIn('concept', ['Lemonway', 'Paypal']);
})
->where('status', 'ok')
->get();
我对这种语法一无所知,但是('status'、'='、'ok')之前的三个where条件中的一个不可能导致status=Pending Transaction的行吗?运算符优先级是
NOT/和/或,您的语法可能导致(…)或status='ok'