How to have reverse order output on MYSQL database

前端 未结 6 827
無奈伤痛
無奈伤痛 2020-12-11 19:33

I have a basic write to and retrieve sql database php \"thing\" and I want to have the output in descending order. How do I do that?

Eg. last entry is shown first,

6条回答
  •  不知归路
    2020-12-11 20:17

    If there's an auto increment field, you order by that field, descending.

    SELECT "column_name"
     FROM "table_name"
     [WHERE "condition"]
     ORDER BY "column_name" [ASC, DESC]; 
    

    That's from http://www.1keydata.com/sql/sqlorderby.html

提交回复
热议问题