Top "Greatest-n-per-group" questions

Query the row with the greatest/least value per group.

Laravel 5 eager loading with limit

I have two tables, say "users" and "users_actions", where "users_actions" has an hasMany relation with users: users id | …

php laravel-5 eloquent greatest-n-per-group eager-loading
Left outer join with only first row

I have a query something like SELECT S.product_id, S.link, C.id AS category_id FROM Products P …

sql sql-server greatest-n-per-group