SELECT * FROM a LEFT JOIN (SELECT user_id,count(user_id) from bGROUP BY user_id) as v1 ON a.user_id= v1.user_id;
3 回答
慕妹3242003
TA贡献1824条经验 获得超6个赞
AModel::query()
->from('a')
->join(DB::Raw("SELECT user_id,COUNT(user_id) FROM b
GROUP BY user_id) as v1"),'a.user_id','=','v1.user_id')
->get()
- 3 回答
- 0 关注
- 409 浏览
添加回答
举报
0/150
提交
取消