Laravel 使用 eloquent 生成子查询
Laravel generate subqueries with eloquent
我想生成如下所示的 SQL 查询:
select *
from ocs
where ocs.wfx_oc_no = 'OC11' and
ocs.id in (select id
from buyers
where buyers.buyer_code = 'B01')
有人可以帮助我如何使用 laravel 子查询吗?
$data = OCS::where('wfc_oc_no','OC11')->where('id', Buyers::where('buyer_code','B01')->first())->get();
我想生成如下所示的 SQL 查询:
select *
from ocs
where ocs.wfx_oc_no = 'OC11' and
ocs.id in (select id
from buyers
where buyers.buyer_code = 'B01')
有人可以帮助我如何使用 laravel 子查询吗?
$data = OCS::where('wfc_oc_no','OC11')->where('id', Buyers::where('buyer_code','B01')->first())->get();