![]() |
how to sort this????
$sql="select * from my table order by lastname LIMIT 0,5"
if i have this display lastname a b c d e and i have a data in my table a b c d e f g h i j k l m n o p i want to sort only the abcde by desc.what would i do? what i did is this one $sql="select * from my table order by lastname sort desc LIMIT 0,5" this query displays this--->ponml i want my display would be edcba |
PHP Code:
Limit it to 5 would be PHP Code:
|
Gurnk, i don't think you understand him.
On such a small dataset it wouldn't be very good to use mysql the way i propose and use PHP instead, however with a larger dataset i see why you would be concerned. The method i recommend to fix this would be to use a sub-query to fetch the ID's to rank for like so: PHP Code:
What this does, is create a result set to work with first (temporary table) and then do the ordering after. |
yeah it works...thanks bluesaga
|
| All times are GMT. The time now is 02:49 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0