ページネーションリクエストのソート順に手間取ってます。
MySQLのViewテーブルに、idとdate_orderdという2つのフィールドを作りました。
これはメインテーブルのデータフィールドの最初の2つです。
他のアプリの時はこのやり方でうまくいっているのです。
生成されたSQL文に"ORDER BY句"が無いのはどうしてですか?
lang
1public function adminInfo($id=null) { 2 $today = date("Y-m-d"); 3 $this->DA->recursive = 0; 4 $this->paginate = array( 5 'conditions' => array( 6 'DAO.date_ordered LIKE '=>"$today%", 7 ), 8 'joins' => array( 9 array( 10 'table' => 'DA_ordered', 11 'alias' => 'DAO', 12 'type' => 'INNER', 13 'foreignKey' => false, 14 'conditions'=> '`DAO`.`id` = `DA`.`id`' 15 ) 16 ), 17 'order' => array('DAO.date_ordered' => 'desc'), 18 'limit' => 1500 19 ); 20 21 $this->set('req', $this->paginate()); 22}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。