MySQL - Reversed ORDER BY

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

MySQL - Reversed ORDER BY

Post by James M. »

Alright, I have a table that stores news and I need to display the news backwards so that the latest news is at the top, and oldest at the bottom. Can anyone help? I've searched the forum, but couldn't find anything. TIA.
Vicious
Forum Contributor
Posts: 105
Joined: Fri Jun 20, 2003 12:40 pm

Post by Vicious »

this should help either put DESC OR ASC, i can remember which one is which, but make sure its at the end of the statement. unless its followed by a LIMIT. ex.
$db = mysql_query("SELECT * FROM `table` ORDER BY `row` DESC LIMIT 6");

Below is the line that should be used.
ORDER BY `row` DESC
Last edited by Vicious on Sun May 08, 2005 1:24 am, edited 1 time in total.
User avatar
James M.
Forum Contributor
Posts: 119
Joined: Wed Mar 31, 2004 6:41 pm
Location: Tallahassee

Post by James M. »

lol, I feel stupid now, was looking at the mysql documents and the DESC and ASC didn't register that they could be ascend and descend. Thanks.
Post Reply