0

I have 2 records in each table. when i tried this below query  

$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();

i got the repeated data from the last table alone and also i couldn't get the data from first three tables

I need an output like this

--------------------------------
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
--------------------------------
Arunkumar
  • 23
  • 1
  • 10

0 Answers0