Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

OK. I figured it out by myself.

$subject_list = DB::table('subjects')
->join('users as provider', 'provider.user_id', '=', 'subjects.provider')
->leftjoin('users as replier', 'replier.user_id', '=', 'subjects.replier')
->select('provider.user_name as provider_name', 'replier.user_name as replier_name', 'subjects.*')
->get();
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Learner learner Joined 18 Aug 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.