How do you order the results of a mysql query.
I need to show all the results from the table with the highest number in a particular field and order them.
I think that makes sense...
TIA
| SitePoint Sponsor |



How do you order the results of a mysql query.
I need to show all the results from the table with the highest number in a particular field and order them.
I think that makes sense...
TIA
SiteOptions >> Services :: Products :: Contact
Developers of PHP, C++, Visual Basic, MySQL, and more!





SELECT * FROM records ORDER BY recordid ASC
You can ORDER BY anyfield...and replace "ASC" with "DESC" to order it the opposite way.
Hope this helps.



You are a bloody legend...thankyou X 100000
I knew it would be simple just didnt know how.
THANKYOU THANKYOU THANKYOU THANKYOU
i will calm down now
SiteOptions >> Services :: Products :: Contact
Developers of PHP, C++, Visual Basic, MySQL, and more!





Whoa! That caught me offguard...now Kevin is cursing himself for not replying first, ticked off that some PHP intermediate just happened to know the answer.
Now if you'll exscuse me, dinner is in an hour, and it should take me at least that long to get my head through my bedroom door.





Similar problem, but I use ORDER BY LENGTH(str) and got an error!
You know what the heck is it?![]()
- Son Nguyen
AdSpeed.com - Ad Serving and Ad Management Made Easy
Try this:
SELECT ..., LENGTH(str) AS strLen FROM ... ORDER BY strLen
If that doesn't work, post the actual query you're trying.
Kevin Yank
CTO, sitepoint.com
I wrote: Simply JavaScript | BYO PHP/MySQL | Tech Times | Editize
Baby’s got back—a hard back, that is: The Ultimate CSS Reference
Bookmarks