how to cascade a DB like this SELECT id1, number, (SELECT value FROM table2 WHERE id2 = id1) FROM table1

1 answer 1

I do not like this request, but it should work:

$row = \DB::table('table1') ->select('id as id1','name',DB::raw('(SELECT value FROM table2 WHERE id2=id1) as value')) ->get();