RE: [PHP-DB] Multiple Sorts
| From: | Hutchins, Richard | Date: | Tue, 16 Mar 2004 13:06:41 +0000 |
| Subject: | RE: [PHP-DB] Multiple Sorts | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-33464@lists.php.net to get a copy of this message | ||
Robert,
You should be able to just do:
SELECT * FROM access_tracking WHERE user = '$user_id' ORDER BY time
DESC,date_accessed ASC;
Just experiment with the ORDER BY columns and the ASC and DESC orders to get
the results you're looking for.
Hope this helps,
Rich
> -----Original Message-----
> From: Robert Sossomon [mailto:robert@gcnorris.com]
> Sent: Tuesday, March 16, 2004 7:57 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] Multiple Sorts
>
>
> How can I write a sort to sort on 2 columns, one ascending, one
> descending?
>
> $get_list = "select * from access_tracking where user =
> '$user_id' order
> by time,date_accessed desc"
>
> But the ordering seems backwards sorted by date first, and then time.
>
> TIA!!
> Robert
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>