locked
mysql query in reverse order RRS feed

  • Question

  • User-1722422105 posted

    Hi all

    How to get the result of select * from emp in reverse order 

    botttom record will show first

    Tuesday, June 26, 2018 9:34 AM

All replies

  • User-492460945 posted

    Hello sidu,

    If your database table have any ID field, fetch the data based on that field in descending order.

    Thnaks,

    RajeshV.

    Tuesday, June 26, 2018 9:59 AM
  • User283571144 posted

    Hi sidu,

    As far as I know, to sort in reverse order, you could add the DESC (descending) keyword to the name of the column in the ORDER BY clause that you are sorting by.

    The default is ascending order; this can be specified explicitly using the ASC keyword.

    More details, you could refer to below select exmaple:

     select * from emp ORDER BY [Your column name] DESC

    Related article:

    https://dev.mysql.com/doc/refman/8.0/en/select.html 

    Best Regards,

    Brando

    Wednesday, June 27, 2018 5:15 AM