Mysql
 sql >> Datenbank >  >> RDS >> Mysql

Laravel 4 - JOIN - Gleicher Spaltenname

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

Bearbeiten:

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