SELECT * FROM (
SELECT `* FROM `messages`
ORDER BY `message_id` DESC
LIMIT 15
) AS temp
ORDER BY message_id ASC
Asked
Active
Viewed 65 times
-1

Isabek Tashiev
- 1,036
- 1
- 8
- 14
-
Show us some code. What have you tried already, where does it fail? – Jan Doggen Aug 13 '13 at 19:59
1 Answers
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');
Doc : http://framework.zend.com/manual/1.12/en/zend.db.select.html

Fouad Fodail
- 2,653
- 1
- 16
- 16