我在每张桌子上都有2条记录。当我尝试以下查询
$result = DB::table('table1')
->join('table2','table1.user_id','=', 'table2.user_id')
->join('table3','table1.user_id','=', 'table3.user_id')
->join('table4','table1.user_id','=', 'table4.user_id')
->select('table1.*','table2.email','table3.*','table4.*')
->get();
我从上一张表中获得了重复数据,而且我无法从前三张表中获取数据
我需要像这样的输出
--------------------------------
id email user_id
--------------------------------
1 aaa@test.com 40
2 bbb@test.com 40
1 ccc@test.com 40
2 ddd@test.com 40
1 eee@test.com 40
2 fff@test.com 40
1 ggg@test.com 40
2 hhh@test.com 40
--------------------------------