在 Yii 框架中使用 BETWEEN 的正确方法是什么?
代码:
...
$criteria = new CDbCriteria;
$criteria->condition = 'datetime BETWEEN '.$datetimemin.' AND '.$datetimemax;
$user = Users::model()->find($criteria);
...
错误:
SQL: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '07:10:10 AND 2011-10-10 13:10:10)' at line 1.