i want information from one table and if there is matched info from another table that as well.
this my code
$scoreObject = DB::table(\'responses\')
You could try specifying the join as being a left outer join:
->join('answers as answers', 'responses.answer_id', '=', 'answers.id', 'left outer')
The fourth parameter of the join method is $type
, which when not specified, defaults to the value inner
. But since left join and left outer join are the same thing, you could just use the leftJoin
method instead, to make it more readable:
->leftJoin('answers as answers', 'responses.answer_id', '=', 'answers.id')