0

I try to join three tables which are named attendances, categories, and users. my code is

 $Attendance= DB::table('users')
     ->join('categories','users.U_category_id', '=', 'categories.id')
     ->select('users.*','categories.batch_name')->get();

but I also need to join attendances table where attendances column User_A_ID and users table id are the same. How can I do this?

1 Answer 1

1

You can try it with

$Attendance= DB::table('users')
            ->join('categories','users.U_category_id', '=', 'categories.id')
            ->join('attendances','users.id', '=', 'attendances.User_A_ID')
            ->select('users.*','categories.batch_name')->get();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.