0
I have a simple query on MySQL
, the query lists all the data of a table making a Group By
in the field grupo_id
and listing the latest data from Group By
based on the created_at
. In short, he lists the last data of the group.
The query is simple, I need to turn it into a query Eloquent
, follows the code:
select *
from fundoloja_desocupacao
WHERE created_at IN (
SELECT MAX(created_at)
FROM fundoloja_desocupacao
GROUP BY grupo_id
)
Do you have the class or are you using DB? Which version is Laravel?
– novic