我正在尝试按特定顺序列出表中的值。但它是按条件工作的,而不是为其他条件工作。这是代码
$criteria = new CDbCriteria();
$criteria->condition = 'courseid =:courseid AND batchid =:batchid';
$criteria->params = array(':courseid' => $courseid, ':batchid' => $batchid); //Condition
$criteria->order = 'student_rollno ASC'; //Order by student roll no
$students = Student::model()->findAll($criteria);
答案 0 :(得分:0)
您可以针对您的问题尝试此解决方案。
$criteria = new CDbCriteria();
$criteria->condition = 't.courseid =:course_id AND t.batchid =:batch_id';
$criteria->params = array(':course_id' => $courseid, ':batch_id' => $batchid); //Condition
$criteria->order = 't.student_rollno ASC'; //Order by student roll no
$students = Student::model()->findAll($criteria);