在 laravel 中加入子查询
本文介绍了在 laravel 中加入子查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我快要为一个查询发疯了,有人可以帮我翻译一个查询以在 laravel 中工作,或者用laravel 方式"编写.
I'm about to go crazy about a query, can someone help me to translate a query to work in laravel, or to write in "laravel way".
查询代码如下,使用的是MySQL.
The query code is below, and it's using MySQL.
我被卡住的部分是在第一个 JOIN 中,子查询到另一个 JOIN 它.
The part that I'm stuck is in the first JOIN with the subquery to the other JOIN it.
<小时>
推荐答案
尝试将子查询作为原始表达式作为 leftJoin() 方法中的第一个参数发送,例如:
try to send the subquery as a raw expression as the first parameter in the leftJoin() method, for example:
这些问题中有类似的例子:
there are similar examples in these questions:
Laravel Fluent 查询生成器加入子查询
如何写(左连接, 子查询 ) 在 Laravel 5.1 中?
关于加入的更多信息:https://laravel.com/docs/5.5/queries#joins
这篇关于在 laravel 中加入子查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!