How to convert this sql query to Eloquent ?
SELECT user_id, company_id, MAX(date) date
FROM careers
GROUP BY user_id, comapany_id;
`
How to convert this sql query to Eloquent ?
SELECT user_id, company_id, MAX(date) date
FROM careers
GROUP BY user_id, comapany_id;
`
For further actions, you may consider blocking this person and/or reporting abuse
Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.
Mike Young -
pikoTutorial -
Jordan Knightin -
Mike Young -
Top comments (2)
I just made a tool just for this. You can use it for free:
jjlabajo.github.io/SQLtoEloquent/
$careers = Career::selectRaw('user_id, company_id, MAX(date) as date')->groupBy(['user_id','comapany_id'])->get();