-1
SELECT * FROM ( 
  SELECT  `* FROM  `messages` 
  ORDER BY  `message_id` DESC 
  LIMIT 15
) AS temp
ORDER BY message_id ASC
4

1 に答える 1

0
$sub_select = $db->select();
$sub_select->from('messages');
$sub_select->order('message_id desc');
$sub_select->limit(15);

$select = $db->select();
$select->from(array('temp' => new Zend_Db_Expr('(' . $sub_select . ')')));
$select->order('message_id asc');

ドキュメント: http://framework.zend.com/manual/1.12/en/zend.db.select.html

于 2013-08-13T20:16:43.543 に答える