1

This is my data retrieving query:

$admin_students=DB::select("select students.*,application_record.*,gender_record.*,
application_record.id as app_primary_id,application_record.status as app_status from students 
left join application_record on application_record.student_id=students.id 
left join application_record on application_record.gender_record_id=gender_record.name");

Table structure

Table 1 = application_record - > id, name, status, gender_record_id, .... 

Table 2 = gender_record - > id, name

Now how can I return the Gender Name using the Gender Record ID which is the primary key for "Table 2"?

1 Answer 1

2
   DB:: table('students')
    ->leftjoin('application_record, 'students.id','=' , 'application_record.student_id' )
    ->leftjoin('gender_record','application_record.gender_record_id','=','gender_record.id')->select('students.*',' application_record.*,
    'gender_record.*,)->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.