How to make MySQL sort rows form the Latest create

2020-04-02 03:39发布

I have a doubt here, Is there any way you can tell MySQL to Align or Sort out rows from the newest to the oldest, for an Example I created 2 rows in my Database the First one Hi World And the second one Hello World,Instead of showing from the latest It show's it alpabatically But I want It to show from the newest to the oldest How to have That kind effect? I've even tried using SELECT * FROM pages ORDER BY postID ASC but It does not Work! Please help me.

the Browse tab of the pages table:

enter image description here

the Structure tab of the pages table:

enter image description here

标签: php mysql
2条回答
我想做一个坏孩纸
2楼-- · 2020-04-02 04:08

Use

SELECT * FROM pages ORDER BY postID DESC

to show the latest first (ASC is ascendent)

查看更多
够拽才男人
3楼-- · 2020-04-02 04:24

If you order them by postID ASC, it's from the smallest to the biggest one. The smallest one will be the oldest one, so this is not what you want.

Change the ASC by DESC, and it should work.

SELECT * FROM pages ORDER BY postID DESC
查看更多
登录 后发表回答