我想Mysql Concat Function
在like expression
.
我想合并firstname
和lastname
asfullname
并根据fullname
.
我在 YII1 中试过这个。下面是我的代码:
$criteria = new CDbCriteria();
$criteria->select = "*";
$criteria->select = 'CONCAT(firstname , "" , lastname) AS fullname';
$criteria->addCondition('fullname LIKE :match');
$criteria->params = array(':match' => $query);
$models = User::model()->findAll($criteria);
以下是生成的错误消息:
CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'fullname' in 'where clause'
(Error 500)
CDbCommand::fetchColumn() failed: SQLSTATE[42S22]: Column not found: 1054
Unknown column 'fullname' in 'where clause'. The SQL statement executed
was: SELECT COUNT(*) FROM `members` `t` WHERE fullname LIKE :match.
提前致谢