如何在 Kohana 中将 select 列作为“另一个名称”
how to select column as `another name` in Kohana
我正在使用 Kohana。我正在尝试 select 列作为 some name
但它给出了错误 -
Table 'users AS U' doesn't exist
如何制作这个别名?
$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;
$query = DB::select(array('username', 'u'), array('password', 'p'))->from('users');
https://kohanaframework.org/3.3/guide/database/query/builder#select-as-column-aliases
我正在使用 Kohana。我正在尝试 select 列作为 some name
但它给出了错误 -
Table 'users AS U' doesn't exist
如何制作这个别名?
$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;
$query = DB::select(array('username', 'u'), array('password', 'p'))->from('users');
https://kohanaframework.org/3.3/guide/database/query/builder#select-as-column-aliases