我需要在Laravel的查询构建器中重现以下查询:
select * from table LEFT JOIN table_b ON `condition` AND (`condition` OR `condition`)
我知道你可以做这样复杂的where
语句:
Model::where(function ($query) {
return $query->where("field","value")->orWhere("field","value");
})->where("field","value")->get();
我知道你可以做这样的半复杂on
陈述:
->leftJoin('table', function ($join) {
$join->on("field","=","field_b")
->on("field_a","=","field_c");
})
但我需要condition AND (condition OR condition)
INSIDE on
声明。这可能在没有DB::raw()
或同等的情况下实现吗?
答案 0 :(得分:1)
使用此:
for e in S_li: #going through initial list, all elements available
if e.isdigit() != True: # if it is an integer, create another list within poss
poss.extend(e) #if it is a letter add to the same list in poss.