【发布时间】:2012-04-14 18:30:17
【问题描述】:
in cake php 是我们如何根据查询中的'IN'子句获取查询结果的顺序
$array = array(8,6); // order in 'In' clause
$condition = array('Video.id' => $array);
$videos = $this->Video->find('all', array('conditions' => $conditions));
//The query will be like below
SELECT * FROM `videos` AS `Video` WHERE `Video`.`id` IN (8,6);
目前它会给出结果
Array
(
[0] => Array
(
[Video] => Array
(
[id] => 6
)
)
[1] => Array
(
[Video] => Array
(
[id] => 8
)
)
)
我需要它
Array
(
[0] => Array
(
[Video] => Array
(
[id] => 8
)
)
[1] => Array
(
[Video] => Array
(
[id] => 6
)
)
)
order Desc 或 asc 不会按顺序检索实际结果。如何使用 cake php 恢复?
我用的是cake php,在mysql中能不能做到?
【问题讨论】:
标签: mysql cakephp cakephp-1.3