0
我需要在集合中返回分頁,但我只能在數組中返回,因爲查詢使用自然聯接。 我怎麼能做使用Laravel收藏此查詢:LARAVEL MYSQL如何使用自然JOIN
SELECT mensagens * FROM mensagens自然科學JOIN(SELECT id_emissor,MAX(created_at)created_at FROM mensagens WHERE id_receptor = 「$ user_ID的。」 GROUP BY id_emissor)筆
我已經使用這個代碼:
$ mensagem = \ DB ::選擇( DB ::原始(「SELECT mensagens * FROM mensagens自然連接(SELECT id_emissor,MAX(created_at) created_at FROM mensagens WHER E id_receptor =「。$ user_id。」GROUP BY id_emissor)t「) );
檢查:https://stackoverflow.com/questions/22925451/how-can-i-query-raw-via-eloquent –