![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
![](https://images.cnblogs.com/OutliningIndicators/ExpandedBlockStart.gif)
$subQuery = $model::query() ->from('table1 as a') ->getQuery(); $query = $model::query() ->from('table2 as b') ->joinSub($subQuery, 'sub', 'sub.id', '=', 'b.id');
Enjoy it !
$subQuery = $model::query() ->from('table1 as a') ->getQuery(); $query = $model::query() ->from('table2 as b') ->joinSub($subQuery, 'sub', 'sub.id', '=', 'b.id');
Enjoy it !
转载于:https://www.cnblogs.com/daizhongxing/p/11526653.html