我希望获得所有具有挂起状态的行的结果,然后显示其余没有挂起的行。我无法用正确的语法对数据进行排序。我需要所有挂起的值行,然后是所有其他非挂起的行。
$this->Paginator->settings = array(
// 'conditions' => array('request_status' => 'pending') ,
'order' => array('request_status' => 'pending','request_date'=> 'desc'),
'limit' => 5 );发布于 2014-10-26 01:27:28
可以对多列进行排序,也可以按不同的方向对不同的列进行排序。例如,若要按request_date类型按降序排序,然后按request_type内的request_status按降序排序(“最小的”request_date优先),请使用以下查询:
mysql> SELECT * FROM pet
-> ORDER BY request_status, request_date DESC;CakePHP:
'order' => array('request_status, request_date DESC');DESC关键字仅应用于其前面的列名(request_date);它不影响request_status列的排序顺序,但将对它们进行分组。换句话说,上面的sql查询将按request_status字段的request_date字段顺序对它们进行分组。
另一个用于分页器排序的有用链接--它的这一个。
https://stackoverflow.com/questions/26563191
复制相似问题