Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created June 13, 2019 11:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/59f415251d378e8a67c17f2081145cff to your computer and use it in GitHub Desktop.
Save uno-de-piera/59f415251d378e8a67c17f2081145cff to your computer and use it in GitHub Desktop.
<?php
$tasks = Task::select('id', 'task_id', 'project_id', 'keyword_id')
->whereIn('id', function ($sub) {
$sub->selectRaw('max(id)')->from('tasks')->groupBy('keyword_id'); // <---- la clave
})->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment