我的查询运行良好,这是where子句中唯一的问题。请告诉我什么将查询生成器查询在拉威尔,相当于这个查询
WHERE (interest_request.sender_id = 6 or interest_request.to_user_id = 6)
AND interest_request.interest_status =2
and profiles.profile_id not in (6)
我使用以下查询生成器,但不工作
where('to_user_id',$my_profile_id)->orwhere
('sender_id',$my_profile_id)->where('interest_status','2')
->whereNotIn('profiles.profile_id', $my_profile_id)
2条答案
按热度按时间93ze6v8z1#
在您的特定情况下,必须使用嵌套
where
条款:你也不需要使用
whereIn
(或whereNotIn
)如果列表中只有一个id,则进行查询。yrefmtwq2#
我假设在sql中是这样的:
当我使用orwhere()语句时,我使用回调函数: