I am trying to get following query on Laravel:
SELECT
table1.* ,
table1.colb as aaa
FROM
table1
LEFT jOIN table2 on table2.cola = table1.colb
This is the Laravel DB Query code :
DB::table('table1')
->leftJoin('table2','table2.cola', '=', 'table1.colb')
->select('table1.* , table1.colb as aaa')
->get();
But it doesn't work and I get SQL Syntax error. This is the SQL which Laravel is making using above code which is wrong :
select `table1`.* as `table1.colb`
from `table1`
left join `table2` on `table2`.`cola` = `table1`.`colb`
How can I fix this using laravel way?