Answer the question
In order to leave comments, you need to log in
How to make complex on in join using Query Builder in Eloquent?
There is a query that works 100%, I'm interested in how to transfer this part of it to Query Builder
left join tbl2
on tbl1.parent_id= tbl2.parent_id
and (
isnull(tbl2.id)
or (
tbl2.time = '1970-01-01 00:00:00'
and tbl2.cmd in (0, 1)
)
)
->leftJoin($rawTrades, function($leftJoin) {
$leftJoin
->on("tbl1.parent_id", '=', 'tbl2.parent_id')
->on(function($query){
$query->whereNull('tbl2.id')
->orWhere(function($query){
$query
->where('tbl2.time', '=', '1970-01-01 00:00:00')
->whereIn("tbl2.cmd", [0,1]);
});
});
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question