select tui.*,count(users.id) as number from (select a.uid,a.id as tuiguang_id,a.name,u.tel,u.nickname,case when sum(al.tui_money) is null then 0 else sum(al.tui_money) end as shouyi,case when agent.a_gongsi is null then '直属创骐平台' else agent.a_gongsi end as gongsi from admin as a left join users as u on u.id = a.uid left join user_acount_log as al on al.tuiguang_id = a.id left join agent on agent.aid = a.agentid where a.identity='1' and a.is_tuiguangyuan='0' group by a.uid) as tui left join users on users.tuiguang_id = tui.tuiguang_id group by tui.tuiguang_id
以上sql语句转成laravel的连贯操作,怎么弄?
- 1 回答
- 0 关注
- 1200 浏览
添加回答
举报
0/150
提交
取消