Reputation: 45
This is the $query
configuration that I have:
$query = (new \yii\db\Query())->select("concat_ws(' ', m.first_name, m.last_name) full_name")->from('members m')->orderBy('full_name')->all();
When I open in browser it appear error:
The SQL being executed was: SELECT concat_ws(' ', `m`.`first_name`, `m`.`last_name)` AS `full_name` FROM `members` `m`ORDER BY `full_name`
How to resolve this issue?
Upvotes: 1
Views: 115
Reputation: 133400
try using this array notation
$query = (new \yii\db\Query())->
select(["concat_ws(' ', m.first_name, m.last_name) AS full_name"])->
from('members m')->
orderBy('full_name')->all();
Upvotes: 1