从DESC订购的数据库中获取数据,然后将其反转

时间:2016-04-30 14:29:09

标签: php mysql

我有这个php查询

 $Commentsq=$con->query("SELECT * FROM comments ORDER BY `DATE` DESC LIMIT 4 ");

所以我的结果就是这样 4 3 2 1 我怎样才能使结果成为现实 1 2 3 4

1 个答案:

答案 0 :(得分:4)

您可以使用子查询:

SELECT *
FROM (SELECT * 
      FROM comments 
      ORDER BY `DATE` DESC 
      LIMIT 4) AS s
ORDER BY `DATE`;