根据较旧的时间戳排列数据

时间:2012-12-06 09:38:58

标签: mysql

你好我做了一个查询,其中我根据当前日期安排数据,但问题是结果是从旧到新的形式。我怎样才能通过更新的老年人实现这一目标。这是我的查询

$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);

就像我正在以

的形式获得结果
  

oct nov dec

我想要它

  

dec nov oct

2 个答案:

答案 0 :(得分:1)

试试这个::

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

答案 1 :(得分:0)

 $date = "select CAST(post_date AS DATE) AS dated
          from wp_hdflvvideoshare
          group by dated
          order by dated DESC";