Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous (SQL: select * from
kumeti_member_registrations
left joinmembers list
onmembers list
.id
=kumeti_member registrations
.member_name
whereid
= 2)",
this Query please solve the error
$result = DB::table('kumeti_member_registrations')
->leftjoin('members_list', 'members_list.id', '=', 'kumeti_member_registrations.member_name')
->where('id', $id)
->get();
CodePudding user response:
You need to specify the table name as id
is common in both tables and is therefore ambiguous
So
->where('kumeti_member_registrations.id', $id)
CodePudding user response:
Try this:
$result = DB::table('kumeti_member_registrations')
->leftjoin('members_list', 'members_list.id', '=', 'kumeti_member_registrations.member_name')
->where('kumeti_member_registrations.id', $id)
->get();