1
下面是我生MySQL
查詢:需要原始查詢轉換爲laravel雄辯
SELECT T1.id, T1.department_id, COALESCE(T2.cnt, 0) AS cnt
FROM (SELECT DISTINCT id, department_id FROM users WHERE company_id = '33') AS T1
LEFT JOIN (
SELECT user_id, COUNT(*) AS cnt
FROM userlogs
WHERE created_at BETWEEN '2015-12-17' AND '2016-01-12'
GROUP BY user_id
) AS T2 ON T2.user_id = t1.id
任何一個可以幫助我將其轉換爲Eloquent
?我是Laravel
的新手。
你真的使用'laravel-3'?你還試過了什麼? –
請告訴我們你試過了什麼? –
Laravel 3不再支持 –