Solution for "laravel QueryBuilder jion"

$latestPosts = DB::table('posts') ->select('user_id', DB::raw('MAX(created_at) as last_post_created_at')) ->where('is_published', true) ->groupBy('user_id'); $users = DB::table('users') ->joinSub($latestPosts, 'latest_posts', function ($join) { $join->on('users.id', '=', 'latest_posts.user_id'); })->get();

laravel join

Similar codes for "laravel QueryBuilder jion"


Latest 'PHP' questions

Added before "laravel QueryBuilder jion"