几乎在每个维基中都解释了简单的事情.我陷入了yii的CDbcriteria比较问题.
只有精确的"等于"匹配解释为:
select * from users where status ='active'
Run Code Online (Sandbox Code Playgroud)
这种比较解释如下:
$criteria->compare('status','active');
Run Code Online (Sandbox Code Playgroud)
但是我找不到一个用基于运算符的搜索来描述它的示例脚本.喜欢不等于以下查询:
select * from users where status !='active'
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点?
尝试这样的事情
$criteria->condition = " status<>'active'";
$criteria->compare('status',$this->status,true);
Run Code Online (Sandbox Code Playgroud)