反向PHP mysql_fetch_array

时间:2013-11-29 18:47:51

标签: php mysql arrays sorting

反向PHP mysql_fetch_array

我从数据库中获取最后4行,但我想要反向排序这4行

mysql_query("SELECT * FROM `table` ORDER BY `id` DESC LIMIT 4");

我该怎么做?

1 个答案:

答案 0 :(得分:4)

mysql_query("SELECT * FROM (SELECT * FROM table ORDER BY id DESC LIMIT 4) t ORDER BY id ASC");

我认为应该这样做