Search code examples
mysqlrecords

Showing last to first mysql entries


I'm currently working on a website and I have a table called appeals that I want to display the latest records from. What would the query be to do this? So instead of displaying first to last I want it to display last to first.

The current query I have is:

$query = "SELECT id,user,title,reason,appealdate,closed FROM appeals WHERE closed='0'";


Solution

  • Just revert an order with ORDER BY id DESC:

      SELECT id,user,title,reason,appealdate,closed
        FROM appeals
       WHERE closed='0'
    ORDER BY id DESC