Mysql
 sql >> Base de données >  >> RDS >> Mysql

Laravel 4 - JOIN - Même nom de colonne

$query = DB::table('packages')
->join(...)
->join(...)
->select(DB::raw('packages.name as name1, assigned_packages.name as name2'))
->get();

modifier :

$sql = "select a.name as name1, b.name as name2";
$sql .= " from a left join b on a.id=b.id1 and b.id2=&id";
$result = DB::select($sql);