您好,我在查询中根据当前日期排列数据,但问题是结果以旧到新的形式出现。我怎样才能做到这一点?这是我的查询

$date = "select CAST(post_date AS DATE) AS dated from wp_hdflvvideoshare  group by dated order by (DATE_SUB(CURDATE(), INTERVAL 20 DAY))";
 $date_sql=$wpdb->get_results($date);


就像我以以下形式获得结果


  十月十一月


我想要它


  十二月十一十月

最佳答案

尝试这个 ::

select CAST(post_date AS DATE) AS dated from wp_hdflvvideoshare  group by dated
order by dated desc

关于mysql - 根据时间戳(新到旧)排列数据,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13740717/

10-14 00:29