代码不工作条件正常但订单排序无效
请帮我解决问题
$this->Offer->find(
'all',
array(
'conditions' => array(
'OR' => array(
array('Offer.branch_id' => 1),
array('Offer.branch_id' => $branch['Branch']['id'])
)
)
),
array('order' => array('Offer.order_no' => 'DESC'))
);
答案 0 :(得分:1)
试试此代码: - >
$this->Offer->find(
'all',
array(
'conditions' => array(
'OR' => array(
array('Offer.branch_id' => 1),
array('Offer.branch_id' => $branch['Branch']['id'])
)
),
'order' => array('Offer.order_no' => 'DESC')
)
);
答案 1 :(得分:0)
$this->Offer->find('all', array(
'conditions' => array(
'OR' => array(
'Offer.branch_id' => 1,
'Offer.branch_id' => $branch['Branch']['id']
)
),
'order' => array('Offer.order_no DESC')
));
DESC =降序,是从最后排序order_no ASC =升序,从第一个开始排序