0
我正在使用Kohana。我試圖選擇一列作爲some name
,但它給錯誤 - Table 'users AS U' doesn't exist
如何使這個別名? 如何在Kohana中選擇列作爲'別名'
$result = DB::select('users.firstname',
'users.lastname',
'U.firstname AS alt_firstname',
'U.lastname AS alt_lastname'
)
->from('mytable')
->join('table2', 'INNER')
->on('mytable.id', '=', DB::expr('table2.id'))
->join('users', 'INNER')
->on('users.id', '=', DB::expr('mytable.id'))
->join('users AS U', 'INNER')
->on('U.id', '=', DB::expr('table2.id'))
->execute();
return $result;
謝謝!以及如何以U - >方式連接表用戶,這是否正確 - >' - > join('users AS U','INNER')'? :) –