join three tables

 


$result = DB::table('table1')

            ->join('table2', 'table1.column1', '=', 'table2.column1')

            ->join('table3', 'table1.column2', '=', 'table3.column2')

            ->select('table1.column1 as column1', 'table2.column2 as column2', 'table3.column3 as column3')

            ->get();




$result = DB::table('table1')
            ->join('table2', 'table1.column1', '=', 'table2.column1')
            ->join('table3', 'table1.column2', '=', 'table3.column2')
            ->select('table1.column1 as column1', 'table2.column2 as column2', 'table3.column3 as column3')
            ->get();



SELECT t1.column1 AS column1, t2.column2 AS column2, t3.column3 AS column3
FROM table1 AS t1
JOIN table2 AS t2 ON t1.column1 = t2.column1
JOIN table3 AS t3 ON t1.column2 = t3.column2;





















sql



No comments:

Post a Comment

React -1 ( react with ravenndra kanchi)

 react with tool chanis 45 to 50 sessions core  after 50 sessions -> some tooll chains == react with type script mern stackaplication in ...