Sort question (mysql)

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
Cypher87
Forum Newbie
Posts: 5
Joined: Mon Jun 07, 2004 3:20 pm

Sort question (mysql)

Post by Cypher87 »

Simple question I think

When I sort something (using mysql) it comes out like:

sort1
sort2
sort3

But I want it to sort like:

sort3
sort2
sort1

How can I do this?
User avatar
johnperkins21
Forum Contributor
Posts: 140
Joined: Mon Oct 27, 2003 4:57 pm

Post by johnperkins21 »

Use this instead:

Code: Select all

<?php
mysql_query("SELECT * FROM Table ORDER BY ColumnID DESC");

?>
That DESC in there is what you need. Check out http://dev.mysql.com/doc/mysql/en/SELECT.html for more info.
Post Reply