Re: MySQL and sorting
| From: | Tyler Longren | Date: | Tue, 21 May 2002 04:03:30 +0000 |
| Subject: | Re: MySQL and sorting | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98558@lists.php.net to get a copy of this message | ||
The MySQL manual will explain this in great detail.
To sort by date:
SELECT * FROM table ORDER BY date ASC;
for that to work, all the values in date should be a timestamp (ex:
20020520000000)
To sort by names:
SELECT * FROM table ORDER BY name ASC;
If you want reverse the order, replace the 'ASC' with 'DESC'.
Tyler Longren
Captain Jack Communications
www.captainjack.com
tyler@captainjack.com
----- Original Message -----
From: "Cleeker" <cleeker@gmx.net>
To: <php-general@lists.php.net>
Sent: Monday, May 20, 2002 9:11 PM
Subject: [PHP] MySQL and sorting
> Is there a way to extract lets say a bunch of dates from a mysql db, and
> the sort them in order from newest to oldest? Also how would you sort
> names in alphabetical order?
>
> ~Cleeker
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>