这种SQL该怎么写ORM查询构造器?
SELECT
id,
( SELECT SUM( man_hour ) FROM work_list WHERE work_list.creator_id = user_list.id ) AS aa
FROM
user_list
WHERE
USER.id = 123
SELECT
id,
( SELECT SUM( man_hour ) FROM work_list WHERE work_list.creator_id = user_list.id ) AS aa
FROM
user_list
WHERE
USER.id = 123
2 Comments
通过selectRaw方法调用原生SQL语句吧 ORM不是万能的
楼上说的对,你这是多表查询吧,我也觉得selectRaw方法是个不错的解决方案