How to add another table after joining multiple tables in Laravel?

I'm trying to achieve the following MySQL query with Laravel

SELECT a.*, b.*, c.* FROM table_1 a LEFT JOIN table_2 b ON a.b_id = b.id, table_3 c WHERE c.age > 21;

I know how to join tables in Laravel. But if you see my SQL query carefully you can find that there is another table just after the left join (without any join). This is where I'm stuck.

I tried the following code in Laravel, but didn't work.

DB::table(DB::raw('table_1 a, table_3 c'))
->select('a.*', 'b.*', 'c.*')
->leftJoin('table_2 b', 'a.b_id', '=', 'b.id')
->where('c.age', '>', 21)
->get();

Please help me out with the proper solution. Thanks in advance.

Note: Please ignore syntax error if any



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3C1xLIo
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

BlueHost Web Hosting Review: Secrets Revealed for Shared Hosting

How to Create Treeview with Bootstrap and jQuery

Submit Form using jQuery AJAX and PHP without Page Refresh